Thanks for your help Stefan and pspad.
As usual, the answer is "RTFM".
My little script is already in v2.0 and no longer uses the caretY property. I've
written a script to take the set of lines across which the user has selected and
prepends the lines with the line numbers. I often discuss snippets of code via
email with collaborators and thought this would be useful.
The function is: (and cut and paste using my own function):
11: // Author: ppar
12: // Date: 2008-07-21
13: function getBlockWithNumbers(){
14:
15: var myEd = newEditor();
16: myEd.assignActiveEditor();
17:
18: var XStart, YStart, XEnd, YEnd;
19: XStart = myEd.blockBeginX();
20: YStart = myEd.blockBeginY();
21: XEnd = myEd.blockEndX();
22: YEnd = myEd.blockEndY();
23:
24: var clipText = "";
25:
26: for (lineY = YStart; lineY <= YEnd; lineY++)
27: {
28:
29: myEd.setCaretPos(-1, lineY);
30: clipText += lineY + ": " + myEd.lineText() + "\n";
31:
32: }
33:
34: setClipboardText(clipText);
35:
36: myEd.setBlockBegin(XStart, YStart);
37: myEd.setBlockEnd(XEnd, YEnd);
38:
39: }
Thank you again for your help, and for the great editor that lets me build in
functionality like this.
dpar
--
<http://forum.pspad.com/read.php?2,46907,46965>
PSPad freeware editor http://www.pspad.com