Skip to content

vim+sourceview: Fix extending selection left

When using vim keybindings to enter visual "selection" mode and moving the cursor back immediately after entering visual mode the selection would become empty because both marks are at the same position. The expected behavior is for the selection to extend to the previous character.

Example:

This is som|e| text

When the cursor is on e and we enter visual mode, the insert and selection marks are where the | symbols are, insert is the left-hand | and selection the right-hand |.

When we then use h to move the cursor left we would end up in the following situation:

This is som||e text

So now the insert and selection mark are in the same position, this makes the selection empty.

We also expected to move to the situation below:

This is so|me| text

Such that the selection is extended to the left to include m.

Merge request reports

Loading