vim-patch:9.1.1175: inconsistent behaviour with exclusive selection and motion commands (#32745)

Problem:  inconsistent behaviour with exclusive selection and motion
          commands (aidancz)
Solution: adjust cursor position when selection is exclusive
          (Jim Zhou)

fixes: vim/vim#16278
closes: vim/vim#16784

c8cce711dd

Co-authored-by: Jim Zhou <jimzhouzzy@gmail.com>
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
This commit is contained in:
zeertzjq
2025-03-06 08:24:13 +08:00
committed by GitHub
parent a261f602a0
commit 1a35eb9b56
4 changed files with 72 additions and 6 deletions

View File

@@ -19,6 +19,7 @@
#include "nvim/memline.h"
#include "nvim/memory.h"
#include "nvim/move.h"
#include "nvim/normal.h"
#include "nvim/option_vars.h"
#include "nvim/pos_defs.h"
#include "nvim/search.h"
@@ -427,6 +428,13 @@ int end_word(int count, bool bigword, bool stop, bool empty)
curwin->w_cursor.coladd = 0;
cls_bigword = bigword;
// If adjusted cursor position previously, unadjust it.
if (*p_sel == 'e' && VIsual_active && VIsual_mode == 'v'
&& VIsual_select_exclu_adj) {
unadjust_for_sel();
}
while (--count >= 0) {
// When inside a range of folded lines, move to the last char of the
// last line.