neovim

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

commit 36361d6e4a189e0d53a26bdaa8d9aa5db791b6d7
parent 75d38bb844fe5386df7c1a5efe59a2ce39396b98
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Fri,  8 Aug 2025 21:18:21 +0800

vim-patch:9.1.1604: completion: incsearch highlight might be lost (#35236)

Problem:  completion: incsearch highlight might be lost after search
          completion (Hirohito Higashi)
Solution: Restore incsearch highlight after dismissing pum with Ctrl-E
          (Girish Palya)

related: vim/vim#17870
closes: vim/vim#17891

https://github.com/vim/vim/commit/04c9e78cd33216dfd2cc59b748d1e267d6920c9a

This change actually isn't needed as Nvim doesn't call update_screen()
to redraw pum, but it doesn't hurt either.

Co-authored-by: Girish Palya <girishji@gmail.com>
Diffstat:
Msrc/nvim/ex_getln.c | 12+++++-------
Mtest/functional/legacy/cmdline_spec.lua | 15+++++++++++++++
Mtest/old/testdir/test_cmdline.vim | 6++++++
3 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c @@ -1489,13 +1489,11 @@ static int command_line_execute(VimState *state, int key) // If already used to cancel/accept wildmenu, don't process the key further. if (wild_type == WILD_CANCEL || wild_type == WILD_APPLY) { // Apply search highlighting - if (wild_type == WILD_APPLY) { - if (s->is_state.winid != curwin->handle) { - init_incsearch_state(&s->is_state); - } - if (KeyTyped || vpeekc() == NUL) { - may_do_incsearch_highlighting(s->firstc, s->count, &s->is_state); - } + if (s->is_state.winid != curwin->handle) { + init_incsearch_state(&s->is_state); + } + if (KeyTyped || vpeekc() == NUL) { + may_do_incsearch_highlighting(s->firstc, s->count, &s->is_state); } return command_line_not_changed(s); } diff --git a/test/functional/legacy/cmdline_spec.lua b/test/functional/legacy/cmdline_spec.lua @@ -484,6 +484,21 @@ describe('cmdline', function() /the^ | ]]) + -- 'incsearch' highlight is restored after dismissing popup (Ctrl_E) + feed('<esc>') + command('set wop=pum is nohls') + feed('gg/th<tab><c-e>') + screen:expect([[ + the | + {2:th}ese | + the | + foobar | + thethe | + thethere | + {1:~ }|*3 + /th^ | + ]]) + feed('<esc>') end) diff --git a/test/old/testdir/test_cmdline.vim b/test/old/testdir/test_cmdline.vim @@ -4659,6 +4659,12 @@ func Test_search_wildmenu_screendump() call term_sendkeys(buf, "\<c-n>\<c-y>") call VerifyScreenDump(buf, 'Test_search_wildmenu_8', {}) + " 'incsearch' highlight is restored after dismissing popup (Ctrl_E) + call term_sendkeys(buf, "\<esc>:set wop=pum is hls&\<cr>") + call term_sendkeys(buf, "gg/th\<tab>\<c-e>") + call TermWait(buf, 50) + call VerifyScreenDump(buf, 'Test_search_wildmenu_9', {}) + call term_sendkeys(buf, "\<esc>") call StopVimInTerminal(buf) endfunc