February 23, 2008 at 1:58 pm #5496
shaohao
Member
I just wrote a more complex Macro for the selected text status.
anchorX = document.selection.GetAnchorPointX(eePosLogical);
anchorY = document.selection.GetAnchorPointY(eePosLogical);
activeX = document.selection.GetActivePointX(eePosLogical);
activeY = document.selection.GetActivePointY(eePosLogical);
lines = 0;
chars = document.selection.text.length;
if ( chars != 0) { // really select something
if ( activeY > anchorY) {
lines = activeY - anchorY + 1;
if ( activeX == 1) lines--;
} else if ( activeY < anchorY) {
lines = anchorY - activeY + 1;
if ( anchorX == 1) lines--;
} else /* activeY == anchorY */ {
lines = 1;
}
}
status = "Selected: " + lines + "lines, " + chars + " chars";