Consider this Lua function:
print(editor.CurrentPos..':'..editor:WordEndPosition(editor.CurrentPos))
If cursor is at the word end (current position is same as end position) then editor:WordEndPosition reports position larger by 1. If cursor is inside word, then reported word end position is correct.
The same faulty rule can be observed for editor:WordStartPosition, too.
It looks like something is forbidding
editor.CurrentPosto be same with either or reported positioning functions.This function looks at the character after the position, then searches forward for the next change in character class. They never look at the previous character. Its exposing the code Scintilla uses for the Ctrl+Right key.
Can not see the logic...
For example, I have document with content:
If I place the cursor inside each word I get
0:5and6:11respectively forWordStartPositionandWordEndPosition.If I place the cursor after letter "o" in Hello, it's
CurrentPosis5as expected, whileWordEndPositionis reported6which isWordStartPositionof the next word.Also if place the cursor after letter "d" in World, and if there is no space after it, I get
6:11, but if I add single space I get6:12.If this is how it is supposed to work then Ok.
Maybe just it does not make sense to my expectations.
That is how it is supposed to work, just like the Ctrl+Right key.