mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 03:05:11 -07:00
ui: fix glitch with both ext_cmdline and cmd_wildmenu
This commit is contained in:
parent
9714b9f590
commit
ba7d6a9e6b
@ -3455,8 +3455,10 @@ nextwild (
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
MSG_PUTS("..."); /* show that we are busy */
|
||||
ui_flush();
|
||||
if (!ui_is_external(kUIWildmenu)) {
|
||||
MSG_PUTS("..."); // show that we are busy
|
||||
ui_flush();
|
||||
}
|
||||
|
||||
i = (int)(xp->xp_pattern - ccline.cmdbuff);
|
||||
xp->xp_pattern_len = ccline.cmdpos - i;
|
||||
|
@ -10,6 +10,8 @@ describe('external cmdline', function()
|
||||
local last_level = 0
|
||||
local cmdline = {}
|
||||
local block = nil
|
||||
local wild_items = nil
|
||||
local wild_selected = nil
|
||||
|
||||
before_each(function()
|
||||
clear()
|
||||
@ -43,6 +45,12 @@ describe('external cmdline', function()
|
||||
block[#block+1] = data[1]
|
||||
elseif name == "cmdline_block_hide" then
|
||||
block = nil
|
||||
elseif name == "wildmenu_show" then
|
||||
wild_items = data[1]
|
||||
elseif name == "wildmenu_select" then
|
||||
wild_selected = data[1]
|
||||
elseif name == "wildmenu_hide" then
|
||||
wild_items, wild_selected = nil, nil
|
||||
end
|
||||
end)
|
||||
end)
|
||||
@ -527,4 +535,114 @@ describe('external cmdline', function()
|
||||
expect_cmdline(1, '{RBP1:(}a{RBP2:(}b{RBP2:)}a{RBP1:)}')
|
||||
end)
|
||||
end)
|
||||
|
||||
it('works together with ext_wildmenu', function()
|
||||
local expected = {
|
||||
'define',
|
||||
'jump',
|
||||
'list',
|
||||
'place',
|
||||
'undefine',
|
||||
'unplace',
|
||||
}
|
||||
|
||||
command('set wildmode=full')
|
||||
command('set wildmenu')
|
||||
screen:set_option('ext_wildmenu', true)
|
||||
feed(':sign <tab>')
|
||||
|
||||
screen:expect([[
|
||||
^ |
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
|
|
||||
]], nil, nil, function()
|
||||
eq({{
|
||||
content = { { {}, "sign define"} },
|
||||
firstc = ":",
|
||||
indent = 0,
|
||||
pos = 11,
|
||||
prompt = ""
|
||||
}}, cmdline)
|
||||
eq(expected, wild_items)
|
||||
eq(0, wild_selected)
|
||||
end)
|
||||
|
||||
feed('<tab>')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
|
|
||||
]], nil, nil, function()
|
||||
eq({{
|
||||
content = { { {}, "sign jump"} },
|
||||
firstc = ":",
|
||||
indent = 0,
|
||||
pos = 9,
|
||||
prompt = ""
|
||||
}}, cmdline)
|
||||
eq(expected, wild_items)
|
||||
eq(1, wild_selected)
|
||||
end)
|
||||
|
||||
feed('<left><left>')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
|
|
||||
]], nil, nil, function()
|
||||
eq({{
|
||||
content = { { {}, "sign "} },
|
||||
firstc = ":",
|
||||
indent = 0,
|
||||
pos = 5,
|
||||
prompt = ""
|
||||
}}, cmdline)
|
||||
eq(expected, wild_items)
|
||||
eq(-1, wild_selected)
|
||||
end)
|
||||
|
||||
feed('<right>')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
|
|
||||
]], nil, nil, function()
|
||||
eq({{
|
||||
content = { { {}, "sign define"} },
|
||||
firstc = ":",
|
||||
indent = 0,
|
||||
pos = 11,
|
||||
prompt = ""
|
||||
}}, cmdline)
|
||||
eq(expected, wild_items)
|
||||
eq(0, wild_selected)
|
||||
end)
|
||||
|
||||
feed('a')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
|
|
||||
]], nil, nil, function()
|
||||
eq({{
|
||||
content = { { {}, "sign definea"} },
|
||||
firstc = ":",
|
||||
indent = 0,
|
||||
pos = 12,
|
||||
prompt = ""
|
||||
}}, cmdline)
|
||||
eq(nil, wild_items)
|
||||
eq(nil, wild_selected)
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
@ -176,6 +176,10 @@ function Screen:try_resize(columns, rows)
|
||||
self:sleep(0.1)
|
||||
end
|
||||
|
||||
function Screen:set_option(option, value)
|
||||
uimeths.set_option(option, value)
|
||||
end
|
||||
|
||||
-- Asserts that `expected` eventually matches the screen state.
|
||||
--
|
||||
-- expected: Expected screen state (string). Each line represents a screen
|
||||
|
Loading…
Reference in New Issue
Block a user