How to URL-encode/decode SELECTED text in Notepad++
Asked Answered
S

2

7

There is a question here on stack overflow that answers PART of my question (see link) https://mcmap.net/q/277840/-can-we-decode-url-with-notepad

Unfortunately, this solution is cumbersome, because it always encodes/decodes the ENTIRE current document.

My question is: How can I change the JavaScript in that solution to only modify whatever text is SELECTED in the current document?

I tried using Editor.currentView.selected, but that throws an error when the script runs. If only I could find a document describing what all functions objects and properties are visible to the jN plugin. I suppose that's a topic for another question. Oh well.

Sarcoma answered 1/10, 2014 at 18:0 Comment(0)
S
3

Arg. So often we find that just as we had given up, we were on the verge of finding our own answer. So it was in this case. To answer both my curiosities expressed above:

1) A list of the objects and their members that are part of the jN pugin can be found on that project's home page here: http://jn-npp-plugin.googlecode.com/svn/wiki/API/api.xml

2) To access the SELECTED text in the current document view, use Editor.currentView.selection, not Editor.currentView.selected.

The only question this leaves is how to make the encoded/decoded text REMAIN selected after the conversion. The linked document above provides no method or property for selecting/deselecting text--only for getting/setting what text is already selected, and it gets un-selected upon setting/changing it.

Sarcoma answered 1/10, 2014 at 18:22 Comment(1)
Not sure if you got this figured out, but I found the MIME Tools plugin allows for url encoding a selection and after encoding it keeps the selected text selected. You might poke around there to see how they do it.Diatropism
I
6

For URL Decode in Notepad++ : Use the built-in MIME Tools plugin. It comes with the default Notepad++ installation.

Notepad++ url Decode / Encode with MIME Tools screenshot

Isthmian answered 21/3, 2019 at 18:21 Comment(0)
S
3

Arg. So often we find that just as we had given up, we were on the verge of finding our own answer. So it was in this case. To answer both my curiosities expressed above:

1) A list of the objects and their members that are part of the jN pugin can be found on that project's home page here: http://jn-npp-plugin.googlecode.com/svn/wiki/API/api.xml

2) To access the SELECTED text in the current document view, use Editor.currentView.selection, not Editor.currentView.selected.

The only question this leaves is how to make the encoded/decoded text REMAIN selected after the conversion. The linked document above provides no method or property for selecting/deselecting text--only for getting/setting what text is already selected, and it gets un-selected upon setting/changing it.

Sarcoma answered 1/10, 2014 at 18:22 Comment(1)
Not sure if you got this figured out, but I found the MIME Tools plugin allows for url encoding a selection and after encoding it keeps the selected text selected. You might poke around there to see how they do it.Diatropism

© 2022 - 2024 — McMap. All rights reserved.