When deselect by arrow key, move cursor relative to its position, not to start or end of selection

Hello!
I found one very frustraiting moment - something is wrong with the selection of text. For example - i select some string and to move cursor on the next string i must press down key twice. Can i turn this off ? It’s very annoying for me.
Pressing down key, as usual deselects text and move cursor for the one press.
Thanks

2 Likes

To paraphrase: When a user has a selection, typing up, down, left, or right moves the cursor to the front or end of the selection as it deselects. In most text editors, the cursor would move up, down, left, or right relative to the cursor position - regardless of the selection - as it deselects the text.

This is how CodeMirror works. I went to test it in a CodeMirror sandbox, and it does it there too. codemirror-6 demo - CodeSandbox

I wish your title was a bit more descriptive. “Change selection mode” doesn’t explain the issue.

I see what you mean though. It is inconsistent with any other text editor I’ve used.

twopressesToMove

And here is an example of how it can really be jarring. Here I make a backwards selection and then press down. And my cursor goes to a completely different line and position (the end of my selection), instead of going down from where it was.

twopressesToMove2

2 Likes

Just wanted to add a minor note: this behavior doesn’t seem to apply to vi mode, where the arrow keys simply change the (visual mode) selection.

I gave the thread a new title that is more descriptive, tho not necessarily clear. I wasn’t able to sum it up concisely.

2 Likes