Sorry for not replying any earlier. Was pretty busy.

What you propose is another solution but it also impacts the clipboard, i.e. if
the clipboard contains rtf then, after the operation, it will be text only.

I have then tried to cut the elements that need to be swapped into separate
lines and to use the "Swap with Line Below" function but I could not make it
work as a macro. (The function is recorded as follows:
---
ecDeleteLine
ecLineEnd
ecLineBreak
ecSelLineEnd
---
which means that one line is lost when playing the macro.)

Finally I decided to create a script. When you add the following function to the
default JS file, things work as intended to swap characters without touching the
clipboard:
---
function SwapChars() {
        var doc = newEditor();
        doc.assignActiveEditor();
        doc.command("ecLeft");
        doc.command("ecSelRight");
        doc.command("ecSelRight");
        var sel = doc.selText();
        doc.selText(sel.substr(1,1) + sel.substr(0,1));
}
---
The function is initialised as follows:
  addMenuItem("Swap Chars", "JScript sample", "SwapChars", "CTRL+F9");
---
To swap complete words it needs to be modified a bit but the general idea
remains the same.

Thanks again for an excellent editor!

-- 
<http://forum.pspad.com/read.php?2,31223,31560>
PSPad freeware editor http://www.pspad.com

Odpovedet emailem