From 2b29905c7f55098fb13a0d5b2f5382873c19d874 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 10 Aug 2026 08:39:14 +0800 Subject: [PATCH] vim-patch:9.2.0927: curswant not set on 8g8 (#41255) Problem: curswant not set on 8g8 Solution: Set curswant, adjust tests (Emilien Breton) closes: vim/vim#20979 https://github.com/vim/vim/commit/7fe5cb35f988774745750f89d8adf215c060f57b Co-authored-by: Emilien Breton --- src/nvim/mbyte.c | 1 + test/old/testdir/test_normal.vim | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c index 71ddce35da..886bd1a7ee 100644 --- a/src/nvim/mbyte.c +++ b/src/nvim/mbyte.c @@ -2135,6 +2135,7 @@ void utf_find_illegal(void) curwin->w_cursor.col += l; } } + curwin->w_set_curswant = true; goto theend; } p += len; diff --git a/test/old/testdir/test_normal.vim b/test/old/testdir/test_normal.vim index f21e9b9954..868e80e3f8 100644 --- a/test/old/testdir/test_normal.vim +++ b/test/old/testdir/test_normal.vim @@ -2909,7 +2909,7 @@ func Test_normal_8g8() " With invalid byte. call setline(1, "___\xff___") norm! 1G08g8g - call assert_equal([0, 1, 4, 0, 1], getcurpos()) + call assert_equal([0, 1, 4, 0, 4], getcurpos()) " With invalid byte before the cursor. call setline(1, "___\xff___") @@ -2919,12 +2919,12 @@ func Test_normal_8g8() " With truncated sequence. call setline(1, "___\xE2\x82___") norm! 1G08g8g - call assert_equal([0, 1, 4, 0, 1], getcurpos()) + call assert_equal([0, 1, 4, 0, 4], getcurpos()) " With overlong sequence. call setline(1, "___\xF0\x82\x82\xAC___") norm! 1G08g8g - call assert_equal([0, 1, 4, 0, 1], getcurpos()) + call assert_equal([0, 1, 4, 0, 4], getcurpos()) " With valid utf8. call setline(1, "café")