aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/textobject.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2025-03-06 08:24:13 +0800
committerGitHub <noreply@github.com>2025-03-06 08:24:13 +0800
commit1a35eb9b568e1d916cf86dfb27c723e788254923 (patch)
tree8ee25036a082a444d3f9af5df8856c194eb5c60e /src/nvim/textobject.c
parenta261f602a067c7cb4de39fa6330053c08dcfd5e5 (diff)
downloadrneovim-1a35eb9b568e1d916cf86dfb27c723e788254923.tar.gz
rneovim-1a35eb9b568e1d916cf86dfb27c723e788254923.tar.bz2
rneovim-1a35eb9b568e1d916cf86dfb27c723e788254923.zip
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 https://github.com/vim/vim/commit/c8cce711dde2d8abcf0929b3b12c4bfc5547a89d Co-authored-by: Jim Zhou <jimzhouzzy@gmail.com> Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Diffstat (limited to 'src/nvim/textobject.c')
-rw-r--r--src/nvim/textobject.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/nvim/textobject.c b/src/nvim/textobject.c
index e3b3bba7c1..fda8b45e21 100644
--- a/src/nvim/textobject.c
+++ b/src/nvim/textobject.c
@@ -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.