May 7, 2012 at 11:42 am #10332
Stefan
Participant
Thanks webern, but that doesn’t explains why it works in one version and not in the other.
Anyway, i have now understood that i doesn’t need the part
o.SetActivePoint(eePosLogical, 1, yPosEnd, true);
and also not the part
yPosEnd = o.GetActivePointY(eePosLogical);
New version:
// Shorten the object string, just for fewer typing:
o = document.selection;
// - - -
// Find something backwards/up, here empty line:
o.Find("^s*$",eeFindPrevious | eeFindReplaceRegExp);
// Remember the current line number:
yPosBegin = o.GetActivePointY(eePosLogical) +1;
// - - -
// Find again something downwards
// (here: find an blank line, non-greedy)
// AND move the cursor that way to the found position :
o.Find("^s*$",eeFindNext | eeFindReplaceRegExp);
// Do an selection.
// Set the start of the selection to the remembered line.
// The end of the selection will be the current line:
o.SetAnchorPoint(eePosLogical, 1, yPosBegin);
Similar i use now this to just select down
to the next blank line:
o = document.selection;
//Remember the current line number:
yPos = o.GetActivePointY( eePosLogical );
//Move cursor to found position (here: find an blank line):
o.Find("^$",eeFindNext | eeFindReplaceRegExp);
//Do an selection.
//Set the start of the selection to the remembered line:
o.SetAnchorPoint( eePosLogical, 1, yPos );
.