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é")