diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-11-20 08:24:58 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-20 08:24:58 +0800 |
commit | ac7e0ff32ff18be69e2469ff7fc66370be20a6e1 (patch) | |
tree | b0bf84c47c4e01c8600b89be556038d29148500c | |
parent | f111c32ff9dc63f4db08a27089b666e8fdce3eaf (diff) | |
download | rneovim-ac7e0ff32ff18be69e2469ff7fc66370be20a6e1.tar.gz rneovim-ac7e0ff32ff18be69e2469ff7fc66370be20a6e1.tar.bz2 rneovim-ac7e0ff32ff18be69e2469ff7fc66370be20a6e1.zip |
fix(move): redraw for 'concealcursor' after changing w_wcol (#31276)
-rw-r--r-- | src/nvim/move.c | 9 | ||||
-rw-r--r-- | test/functional/ui/syntax_conceal_spec.lua | 33 |
2 files changed, 34 insertions, 8 deletions
diff --git a/src/nvim/move.c b/src/nvim/move.c index 6324466dcc..b298592683 100644 --- a/src/nvim/move.c +++ b/src/nvim/move.c @@ -150,25 +150,20 @@ static void redraw_for_cursorline(win_T *wp) } } -/// Redraw when w_virtcol changes and +/// Redraw when 'concealcursor' is active, or when w_virtcol changes and: /// - 'cursorcolumn' is set, or /// - 'cursorlineopt' contains "screenline", or -/// - 'concealcursor' is active, or /// - Visual mode is active. static void redraw_for_cursorcolumn(win_T *wp) FUNC_ATTR_NONNULL_ALL { - if (wp->w_valid & VALID_VIRTCOL) { - return; - } - // If the cursor moves horizontally when 'concealcursor' is active, then the // current line needs to be redrawn to calculate the correct cursor position. if (wp->w_p_cole > 0 && conceal_cursor_line(wp)) { redrawWinline(wp, wp->w_cursor.lnum); } - if (pum_visible()) { + if ((wp->w_valid & VALID_VIRTCOL) || pum_visible()) { return; } diff --git a/test/functional/ui/syntax_conceal_spec.lua b/test/functional/ui/syntax_conceal_spec.lua index 57d76e54df..80e38d974a 100644 --- a/test/functional/ui/syntax_conceal_spec.lua +++ b/test/functional/ui/syntax_conceal_spec.lua @@ -198,7 +198,7 @@ describe('Screen', function() end) end) -- a region of text (implicit concealing) - it('cursor position is correct when entering Insert mode with cocu=ni #13916', function() + it('cursor position when entering Insert mode with cocu=ni #13916', function() insert([[foobarfoobarfoobar]]) -- move to end of line feed('$') @@ -217,6 +217,37 @@ describe('Screen', function() {4:-- INSERT --} | ]]) end) + + it('cursor position when scrolling in Normal mode with cocu=n #31271', function() + insert(('foo\n'):rep(9) .. 'foofoobarfoofoo' .. ('\nfoo'):rep(9)) + command('set concealcursor=n') + command('syn match Foo /bar/ conceal cchar=&') + feed('gg5<C-E>10gg$') + screen:expect([[ + foo |*4 + foofoo{1:&}foofo^o | + foo |*4 + | + ]]) + feed('zz') + screen:expect_unchanged() + feed('zt') + screen:expect([[ + foofoo{1:&}foofo^o | + foo |*8 + | + ]]) + feed('zt') + screen:expect_unchanged() + feed('zb') + screen:expect([[ + foo |*8 + foofoo{1:&}foofo^o | + | + ]]) + feed('zb') + screen:expect_unchanged() + end) end) -- match and conceal describe('let the conceal level be', function() |