- AuthorPosts
- October 3, 2017 at 8:37 am #22457Patrick CParticipant
For the following selection:
When selected with line selection mode (eeModeLine)
TopPointY = 3 | BottomPointY = 4 | ActivePointY = 3 | AnchorPointY = 3But when selected with stream selection mode (eeModeStream), including the newline symbol as in the image above
TopPointY = 3 | BottomPointY = 3 | ActivePointY = 3 | AnchorPointY = 3Why this inconsistency in BottomPointY ?
Is it a bug or intended? – Either of which will have implications on the future compatibility of my code.
—————————————————————————————————————————————————–
The strange behaviour btw. goes on:
When selected with line selection mode (eeModeLine)
TopPointY = 2 | BottomPointY = 4 | ActivePointY = 2 | AnchorPointY = 4
Interestingly the anchor point now too extends to line 4, despite line 4 not being selected.When selected with stream selection mode (eeModeStream), including the newline symbol as in the image above
TopPointY = 2 | BottomPointY = 3 | ActivePointY = 3 | AnchorPointY = 2I would prefer if both selection modes would have the same behaviour when run on what basically is the ‘same’ selection (other than its mode)
—————————————————————————————————————————————————–
On the last line (end of document) there is even more odd behaviour:When the last line (end of document) contains some text, then the BottomPointY in line selection mode makes sense:
TopPointY = 3 | BottomPointY = 3 | ActivePointY = 3 | AnchorPointY = 3But when the last line doesn’t contain text (empty string) and is selected by line selection mode:
TopPointY = 3 | BottomPointY = 4 | ActivePointY = 3 | AnchorPointY = 3I.e. the BottomPointY now extends beyond the document!?
—————————————————————————————————————————————————–
I could go on with more examples of this odd behaviour, but presently I would appreciate to know if this behaviour is intended or a bug.Patrick
October 3, 2017 at 10:10 am #22458Patrick CParticipantOk, figured out one consistency in this:
If the last character of the selection is a newline character (or the last two are CR+LF), then BottomPointY will be one line below the actual selection.With one exception:
When the last line is empty but line-selected,
then the last character of that selection is not a new line character but BottomPointY still is one line beyond the end of the selection.Provided future EmEditor versions will continue to have have this BottomPointY behavior, my issue should be solved as I now can simply test whether the last character is new-line or not.
October 3, 2017 at 11:32 am #22459Yutaka EmuraKeymasterHello Patrick,
How did you select with stream selection mode? What was the macro code for it?
October 4, 2017 at 12:15 am #22460Patrick CParticipantHello Yutaka,
Basically I selected with the keyboard (ctrl+F8 for line; shift + end + arrow right for stream)
Written as macro code this would be:to select in line selection mode
editor.ExecuteCommandByID(4154);To select in stream selection mode
document.selection.StartOfLine(false,eeLineView | eeLineHomeText);
document.selection.EndOfLine(true,eeLineView);
document.selection.CharRight(true,1);Importance of virtual space
I now noticed, that a visually (images of the first post #22457) identical selection made in stream selection mode is only different from line selection mode when virtual space is enabled.To me it will remain confusing, that BottomPointY – TopPointY covers n+1 lines when only n were selected with CommandID(4154). Nevertheless, I’ll be fine as long as I can count on this (n+1 lines) consistently being the case when the selection’s last character is a new-line character.
Thanks!
PatrickOctober 4, 2017 at 2:44 pm #22461Yutaka EmuraKeymasterHello Patrick,
Yes, the Virtual Space mode makes a big difference. In other words, the cursor position is where BottomPointY is.
- AuthorPosts
- You must be logged in to reply to this topic.