neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit efd0fa55c8b1ba78692382c52a9d644fdd5488c8
parent 25000be8457f5c2eec12f9551d013ca70cd89e59
Author: luukvbaal <luukvbaal@gmail.com>
Date:   Tue, 24 Jun 2025 16:37:51 +0200

fix(cmdline): validate 'incsearch' cursor for "cmdline_show" redraw (#34630)

Problem:  "cmdline_show" event may be emitted with an invalid cursor
          position, causing a redraw that will clear the match highlight.
Solution: Mark the cursor position as valid so that a "cmdline_show"
          callback that updates the screen does not clear the match highlight.
Diffstat:
Msrc/nvim/ex_getln.c | 1+
Mtest/functional/ui/cmdline2_spec.lua | 11+++++++++++
2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c @@ -556,6 +556,7 @@ static void may_do_incsearch_highlighting(int firstc, int count, incsearch_state curwin->w_cursor = s->search_start; } else if (found != 0) { curwin->w_cursor = end_pos; + curwin->w_valid_cursor = end_pos; // mark as valid for cmdline_show redraw } msg_starthere(); diff --git a/test/functional/ui/cmdline2_spec.lua b/test/functional/ui/cmdline2_spec.lua @@ -43,4 +43,15 @@ describe('cmdline2', function() ]]) n.assert_alive() end) + + it("redraw does not clear 'incsearch' highlight with conceal", function() + exec('call setline(1, ["foo", "foobar"]) | set conceallevel=1 concealcursor=c') + feed('/foo') + screen:expect([[ + {10:foo} | + {2:foo}bar | + {1:~ }|*11 + /foo^ | + ]]) + end) end)