diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 8ad5739bb3..617a11eb2f 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -1465,7 +1465,6 @@ 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) { - return command_line_not_changed(s); // Apply search highlighting if (wild_type == WILD_APPLY) { if (s->is_state.winid != curwin->handle) { @@ -1475,6 +1474,7 @@ static int command_line_execute(VimState *state, int key) may_do_incsearch_highlighting(s->firstc, s->count, &s->is_state); } } + return command_line_not_changed(s); } return command_line_handle_key(s); diff --git a/test/functional/legacy/cmdline_spec.lua b/test/functional/legacy/cmdline_spec.lua index 18b0d58136..f1dbfe8472 100644 --- a/test/functional/legacy/cmdline_spec.lua +++ b/test/functional/legacy/cmdline_spec.lua @@ -445,6 +445,45 @@ describe('cmdline', function() /t.*\n.*\n.^ | ]]) + -- 'incsearch' is redrawn after accepting completion + feed('') + command('set wim=full') + command('set incsearch hlsearch') + feed('/th') + screen:expect([[ + {10:th}e | + {2:th}ese | + {10:th}e | + foobar | + {10:th}e{10:th}e | + {10:th}e{10:th}ere | + {1:~ }|*3 + /th^ | + ]]) + feed('') + screen:expect([[ + {10:th}e | + {2:th}ese | + {10:th}e | + foobar | + {10:th}e{10:th}e | + {10:th}e{10:th}ere | + {1:~ }|*2 + {100:these}{3: the thethe thethere there }| + /these^ | + ]]) + feed('') + screen:expect([[ + {10:the} | + {2:the}se | + {10:the} | + foobar | + {10:thethe} | + {10:thethe}re | + {1:~ }|*3 + /the^ | + ]]) + feed('') end) end) diff --git a/test/old/testdir/test_cmdline.vim b/test/old/testdir/test_cmdline.vim index 9b13bc948e..2647ff89d9 100644 --- a/test/old/testdir/test_cmdline.vim +++ b/test/old/testdir/test_cmdline.vim @@ -4558,6 +4558,16 @@ func Test_search_wildmenu_screendump() call term_sendkeys(buf, "\gg/t.*\\n.*\\n.\") call VerifyScreenDump(buf, 'Test_search_wildmenu_5', {}) + " 'incsearch' is redrawn after accepting completion + call term_sendkeys(buf, "\:set wim=full\") + call term_sendkeys(buf, ":set incsearch hlsearch\") + call term_sendkeys(buf, "/th") + call VerifyScreenDump(buf, 'Test_search_wildmenu_6', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_search_wildmenu_7', {}) + call term_sendkeys(buf, "\\") + call VerifyScreenDump(buf, 'Test_search_wildmenu_8', {}) + call term_sendkeys(buf, "\") call StopVimInTerminal(buf) endfunc