mirror of
https://github.com/neovim/neovim.git
synced 2025-12-11 17:12:40 +00:00
fix(cmdline): make sure pum is removed on leave (#36608)
This commit is contained in:
@@ -933,6 +933,9 @@ static uint8_t *command_line_enter(int firstc, int count, int indent, bool clear
|
|||||||
// sure to still clean up to avoid memory corruption.
|
// sure to still clean up to avoid memory corruption.
|
||||||
if (cmdline_pum_active()) {
|
if (cmdline_pum_active()) {
|
||||||
cmdline_pum_remove(false);
|
cmdline_pum_remove(false);
|
||||||
|
} else {
|
||||||
|
// A previous cmdline_pum_remove() may have deferred redraw.
|
||||||
|
pum_check_clear();
|
||||||
}
|
}
|
||||||
wildmenu_cleanup(&ccline);
|
wildmenu_cleanup(&ccline);
|
||||||
s->did_wild_list = false;
|
s->did_wild_list = false;
|
||||||
|
|||||||
@@ -549,7 +549,7 @@ describe('cmdline', function()
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
feed(':TestCmd a<F8>')
|
feed(':TestCmd a<F8>')
|
||||||
screen:expect([[
|
local s1 = [[
|
||||||
|
|
|
|
||||||
{1:~ }|*3
|
{1:~ }|*3
|
||||||
{1:~ }{4: abc1 }{1: }|
|
{1:~ }{4: abc1 }{1: }|
|
||||||
@@ -558,13 +558,14 @@ describe('cmdline', function()
|
|||||||
{1:~ }{4: abc4 }{1: }|
|
{1:~ }{4: abc4 }{1: }|
|
||||||
{1:~ }{4: abc5 }{1: }|
|
{1:~ }{4: abc5 }{1: }|
|
||||||
:TestCmd a^ |
|
:TestCmd a^ |
|
||||||
]])
|
]]
|
||||||
|
screen:expect(s1)
|
||||||
|
|
||||||
-- Typing a character when pum is open does not close the pum window
|
-- Typing a character when pum is open does not close the pum window
|
||||||
-- This is needed to prevent pum window from flickering during
|
-- This is needed to prevent pum window from flickering during
|
||||||
-- ':h cmdline-autocompletion'.
|
-- ':h cmdline-autocompletion'.
|
||||||
feed('x')
|
feed('x')
|
||||||
screen:expect([[
|
local s2 = [[
|
||||||
|
|
|
|
||||||
{1:~ }|*3
|
{1:~ }|*3
|
||||||
{1:~ }{4: abc1 }{1: }|
|
{1:~ }{4: abc1 }{1: }|
|
||||||
@@ -573,9 +574,10 @@ describe('cmdline', function()
|
|||||||
{1:~ }{4: abc4 }{1: }|
|
{1:~ }{4: abc4 }{1: }|
|
||||||
{1:~ }{4: abc5 }{1: }|
|
{1:~ }{4: abc5 }{1: }|
|
||||||
:TestCmd ax^ |
|
:TestCmd ax^ |
|
||||||
]])
|
]]
|
||||||
|
screen:expect(s2)
|
||||||
|
|
||||||
-- pum window is closed when no completion candidates are available
|
-- pum is closed when no completion candidates are available
|
||||||
feed('<F8>')
|
feed('<F8>')
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
|
|
|
|
||||||
@@ -583,7 +585,19 @@ describe('cmdline', function()
|
|||||||
:TestCmd ax^ |
|
:TestCmd ax^ |
|
||||||
]])
|
]])
|
||||||
|
|
||||||
feed('<esc>')
|
feed('<BS><F8>')
|
||||||
|
screen:expect(s1)
|
||||||
|
|
||||||
|
feed('x')
|
||||||
|
screen:expect(s2)
|
||||||
|
|
||||||
|
-- pum is closed when leaving cmdline mode
|
||||||
|
feed('<Esc>')
|
||||||
|
screen:expect([[
|
||||||
|
^ |
|
||||||
|
{1:~ }|*8
|
||||||
|
|
|
||||||
|
]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- oldtest: Test_long_line_noselect()
|
-- oldtest: Test_long_line_noselect()
|
||||||
|
|||||||
Reference in New Issue
Block a user