mirror of
https://github.com/neovim/neovim.git
synced 2025-09-17 08:48:16 +00:00
ui: fix glitch with both ext_cmdline and cmd_wildmenu
This commit is contained in:
@@ -3455,8 +3455,10 @@ nextwild (
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
MSG_PUTS("..."); /* show that we are busy */
|
if (!ui_is_external(kUIWildmenu)) {
|
||||||
ui_flush();
|
MSG_PUTS("..."); // show that we are busy
|
||||||
|
ui_flush();
|
||||||
|
}
|
||||||
|
|
||||||
i = (int)(xp->xp_pattern - ccline.cmdbuff);
|
i = (int)(xp->xp_pattern - ccline.cmdbuff);
|
||||||
xp->xp_pattern_len = ccline.cmdpos - i;
|
xp->xp_pattern_len = ccline.cmdpos - i;
|
||||||
|
@@ -10,6 +10,8 @@ describe('external cmdline', function()
|
|||||||
local last_level = 0
|
local last_level = 0
|
||||||
local cmdline = {}
|
local cmdline = {}
|
||||||
local block = nil
|
local block = nil
|
||||||
|
local wild_items = nil
|
||||||
|
local wild_selected = nil
|
||||||
|
|
||||||
before_each(function()
|
before_each(function()
|
||||||
clear()
|
clear()
|
||||||
@@ -43,6 +45,12 @@ describe('external cmdline', function()
|
|||||||
block[#block+1] = data[1]
|
block[#block+1] = data[1]
|
||||||
elseif name == "cmdline_block_hide" then
|
elseif name == "cmdline_block_hide" then
|
||||||
block = nil
|
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)
|
end)
|
||||||
end)
|
end)
|
||||||
@@ -527,4 +535,114 @@ describe('external cmdline', function()
|
|||||||
expect_cmdline(1, '{RBP1:(}a{RBP2:(}b{RBP2:)}a{RBP1:)}')
|
expect_cmdline(1, '{RBP1:(}a{RBP2:(}b{RBP2:)}a{RBP1:)}')
|
||||||
end)
|
end)
|
||||||
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)
|
end)
|
||||||
|
@@ -176,6 +176,10 @@ function Screen:try_resize(columns, rows)
|
|||||||
self:sleep(0.1)
|
self:sleep(0.1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Screen:set_option(option, value)
|
||||||
|
uimeths.set_option(option, value)
|
||||||
|
end
|
||||||
|
|
||||||
-- Asserts that `expected` eventually matches the screen state.
|
-- Asserts that `expected` eventually matches the screen state.
|
||||||
--
|
--
|
||||||
-- expected: Expected screen state (string). Each line represents a screen
|
-- expected: Expected screen state (string). Each line represents a screen
|
||||||
|
Reference in New Issue
Block a user