Does this issue occur when all extensions are disabled?: Yes/No
- VS Code Version: 1.85.1
- OS Version: 10.0.22621 Build 22621
In the helix extension I use cursorMode block when in normal mode. Some actions this extension does is make selections (words, paragraphs, functions etc)
When selecting a word the selection.active and the position of the cursor don't match up and cause problems. selection.active is supposed to represent the end of a selection or the last character, but the block cursor sits after the selection instead. This means the API and what we see in the UI don't match up and its impossible to write logic around using this mode without some horrible workarounds.
Steps to Reproduce:
- Clone https://github.com/jasonwilliams/vscode-helix
- Build the extension, go to debug, click Run Extension
- Go to any file and start typing
w to move by word
- You'll notice the block cursor is sitting outside of the selection on the right
- press
; this is supposed to place you on the last character of the selection, but it instead puts you after the selection
- Set a breakpoint here: https://github.com/jasonwilliams/vscode-helix/blob/49156d5ac6efdf2a6001fed1fde60cd2645e026e/src/actions/actions.ts#L392
Once this is done navigate to any file and move by word, by hitting w.

In the gif above I am in this file you can see that the word is highlighted correctly, but the block cursor is sitting after the word (on top of the (.
If i was to query the Position of that selection, it would tell me that the "active" position is the last character, i,e the n. But, we can see the cursor is not on the n but in fact one character to the right of the n.
This means that trying to place the cursor on the last character of a word-selection does this:

Expected Results
The cursor is within the selection and sitting on top of the n.
For instance, if we look at going backwards (when the active is before the anchor), we can see that it does the right thing:
.
We need this same behaviour on the other end of a selection.
This bug has been raised before, but doesn't look like its ever been addressed:
Does this issue occur when all extensions are disabled?: Yes/No
In the helix extension I use cursorMode block when in normal mode. Some actions this extension does is make selections (words, paragraphs, functions etc)
When selecting a word the selection.active and the position of the cursor don't match up and cause problems.
selection.activeis supposed to represent the end of a selection or the last character, but the block cursor sits after the selection instead. This means the API and what we see in the UI don't match up and its impossible to write logic around using this mode without some horrible workarounds.Steps to Reproduce:
wto move by word;this is supposed to place you on the last character of the selection, but it instead puts you after the selectionOnce this is done navigate to any file and move by word, by hitting

w.In the gif above I am in this file you can see that the word is highlighted correctly, but the block cursor is sitting after the word (on top of the
(.If i was to query the Position of that selection, it would tell me that the "active" position is the last character, i,e the
n. But, we can see the cursor is not on thenbut in fact one character to the right of then.This means that trying to place the cursor on the last character of a word-selection does this:

Expected Results
The cursor is within the selection and sitting on top of the
n.For instance, if we look at going backwards (when the
.
activeis before theanchor), we can see that it does the right thing:We need this same behaviour on the other end of a selection.
This bug has been raised before, but doesn't look like its ever been addressed: