mirror of
https://github.com/neovim/neovim
synced 2025-07-16 01:01:49 +00:00
feat(ui): additional arguments for cmdline_show/hide events
Problem: Unable to tell what highlight the prompt part of a cmdline_show event should have, and whether cmdline_hide was emitted after aborting. Solution: Add additional arguments hl_id to cmdline_show, and abort to cmdline_hide.
This commit is contained in:
@ -86,6 +86,11 @@ EVENTS
|
||||
|
||||
• |vim.ui_attach()| callbacks for |ui-messages| `msg_show` events are executed in
|
||||
|api-fast| context.
|
||||
• Various additions for the following UI events:
|
||||
• `cmdline_show`: `hl_id` to highlight the prompt text.
|
||||
• `cmdline_hide`: `abort` indicating if the cmdline was aborted.
|
||||
• `msg_show`: new message kinds: "bufwrite", "completion", "list_cmd",
|
||||
"lua_print", "number_prompt", "search_cmd", "undo", "wildlist".
|
||||
|
||||
HIGHLIGHTS
|
||||
|
||||
|
@ -715,7 +715,7 @@ Activated by the `ext_cmdline` |ui-option|.
|
||||
This UI extension delegates presentation of the |cmdline| (except 'wildmenu').
|
||||
For command-line 'wildmenu' UI events, activate |ui-popupmenu|.
|
||||
|
||||
["cmdline_show", content, pos, firstc, prompt, indent, level] ~
|
||||
["cmdline_show", content, pos, firstc, prompt, indent, level, hl_id] ~
|
||||
content: List of [attrs, string]
|
||||
[[{}, "t"], [attrs, "est"], ...]
|
||||
|
||||
@ -728,8 +728,8 @@ For command-line 'wildmenu' UI events, activate |ui-popupmenu|.
|
||||
`firstc` and `prompt` are text, that if non-empty should be
|
||||
displayed in front of the command line. `firstc` always indicates
|
||||
built-in command lines such as `:` (ex command) and `/` `?` (search),
|
||||
while `prompt` is an |input()| prompt. `indent` tells how many spaces
|
||||
the content should be indented.
|
||||
while `prompt` is an |input()| prompt, highlighted with `hl_id`.
|
||||
`indent` tells how many spaces the content should be indented.
|
||||
|
||||
The Nvim command line can be invoked recursively, for instance by
|
||||
typing `<c-r>=` at the command line prompt. The `level` field is used
|
||||
@ -749,8 +749,9 @@ For command-line 'wildmenu' UI events, activate |ui-popupmenu|.
|
||||
|
||||
Should be hidden at next cmdline_show.
|
||||
|
||||
["cmdline_hide"] ~
|
||||
Hide the cmdline.
|
||||
["cmdline_hide", abort] ~
|
||||
Hide the cmdline. `abort` is true if the cmdline is hidden after an
|
||||
aborting condition (|c_Esc| or |c_CTRL-C|).
|
||||
|
||||
["cmdline_block_show", lines] ~
|
||||
Show a block of context to the current command line. For example if
|
||||
|
@ -136,13 +136,13 @@ void tabline_update(Tabpage current, Array tabs, Buffer current_buffer, Array bu
|
||||
FUNC_API_SINCE(3) FUNC_API_REMOTE_ONLY;
|
||||
|
||||
void cmdline_show(Array content, Integer pos, String firstc, String prompt, Integer indent,
|
||||
Integer level)
|
||||
Integer level, Integer hl_id)
|
||||
FUNC_API_SINCE(3) FUNC_API_REMOTE_ONLY;
|
||||
void cmdline_pos(Integer pos, Integer level)
|
||||
FUNC_API_SINCE(3) FUNC_API_REMOTE_ONLY;
|
||||
void cmdline_special_char(String c, Boolean shift, Integer level)
|
||||
FUNC_API_SINCE(3) FUNC_API_REMOTE_ONLY;
|
||||
void cmdline_hide(Integer level)
|
||||
void cmdline_hide(Integer level, Boolean abort)
|
||||
FUNC_API_SINCE(3) FUNC_API_REMOTE_ONLY;
|
||||
void cmdline_block_show(Array lines)
|
||||
FUNC_API_SINCE(3) FUNC_API_REMOTE_ONLY;
|
||||
|
@ -956,7 +956,7 @@ theend:
|
||||
char *p = ccline.cmdbuff;
|
||||
|
||||
if (ui_has(kUICmdline)) {
|
||||
ui_call_cmdline_hide(ccline.level);
|
||||
ui_call_cmdline_hide(ccline.level, s->gotesc);
|
||||
msg_ext_clear_later();
|
||||
}
|
||||
if (!cmd_silent) {
|
||||
@ -3422,8 +3422,7 @@ static void ui_ext_cmdline_show(CmdlineInfo *line)
|
||||
ui_call_cmdline_show(content, line->cmdpos,
|
||||
cstr_as_string(charbuf),
|
||||
cstr_as_string((line->cmdprompt)),
|
||||
line->cmdindent,
|
||||
line->level);
|
||||
line->cmdindent, line->level, line->hl_id);
|
||||
if (line->special_char) {
|
||||
charbuf[0] = line->special_char;
|
||||
ui_call_cmdline_special_char(cstr_as_string(charbuf),
|
||||
@ -4477,7 +4476,7 @@ static int open_cmdwin(void)
|
||||
invalidate_botline(curwin);
|
||||
if (ui_has(kUICmdline)) {
|
||||
ccline.redraw_state = kCmdRedrawNone;
|
||||
ui_call_cmdline_hide(ccline.level);
|
||||
ui_call_cmdline_hide(ccline.level, false);
|
||||
}
|
||||
redraw_later(curwin, UPD_SOME_VALID);
|
||||
|
||||
|
@ -261,6 +261,7 @@ describe('vim.ui_attach', function()
|
||||
lled in a fast event context |
|
||||
{1:~ }|
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = {
|
||||
{
|
||||
content = { { 'E122: Function Foo already exists, add ! to replace it', 9, 6 } },
|
||||
@ -278,6 +279,7 @@ describe('vim.ui_attach', function()
|
||||
Y)? |
|
||||
{1:~ }|
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = {
|
||||
{
|
||||
content = { { 'replace with Replacement (y/n/a/q/l/^E/^Y)?', 6, 18 } },
|
||||
@ -294,6 +296,7 @@ describe('vim.ui_attach', function()
|
||||
e mouse (q or empty cancels): |
|
||||
{1:^~ }|
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = {
|
||||
{
|
||||
content = { { 'Select:\nOne\nTwo\n' } },
|
||||
@ -359,6 +362,7 @@ describe('vim.ui_attach', function()
|
||||
{9:back from ns: 1.} |
|
||||
{100:Press ENTER or type command to continue}^ |
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
})
|
||||
feed('<cr>')
|
||||
-- Also when scheduled
|
||||
|
@ -91,25 +91,27 @@ local function test_cmdline(linegrid)
|
||||
{1:~ }|*3
|
||||
|
|
||||
]],
|
||||
cmdline = { { abort = true } },
|
||||
}
|
||||
end)
|
||||
|
||||
it('works with input()', function()
|
||||
feed(':call input("input", "default")<cr>')
|
||||
screen:expect {
|
||||
screen:expect({
|
||||
grid = [[
|
||||
^ |
|
||||
{1:~ }|*3
|
||||
|
|
||||
]],
|
||||
^ |
|
||||
{1:~ }|*3
|
||||
|
|
||||
]],
|
||||
cmdline = {
|
||||
{
|
||||
prompt = 'input',
|
||||
content = { { 'default' } },
|
||||
hl_id = 0,
|
||||
pos = 7,
|
||||
prompt = 'input',
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
feed('<cr>')
|
||||
screen:expect {
|
||||
@ -118,6 +120,7 @@ local function test_cmdline(linegrid)
|
||||
{1:~ }|*3
|
||||
|
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
}
|
||||
end)
|
||||
|
||||
@ -210,6 +213,7 @@ local function test_cmdline(linegrid)
|
||||
content = { { 'xx3' } },
|
||||
pos = 3,
|
||||
},
|
||||
{ abort = false },
|
||||
},
|
||||
}
|
||||
|
||||
@ -220,6 +224,7 @@ local function test_cmdline(linegrid)
|
||||
{1:~ }|*3
|
||||
|
|
||||
]],
|
||||
cmdline = { { abort = true } },
|
||||
}
|
||||
end)
|
||||
|
||||
@ -294,6 +299,7 @@ local function test_cmdline(linegrid)
|
||||
{1:~ }|*3
|
||||
|
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
}
|
||||
|
||||
-- Try once more, to check buffer is reinitialized. #8007
|
||||
@ -324,6 +330,7 @@ local function test_cmdline(linegrid)
|
||||
{1:~ }|*3
|
||||
|
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
}
|
||||
end)
|
||||
|
||||
@ -353,6 +360,7 @@ local function test_cmdline(linegrid)
|
||||
{3:[Command Line] }|
|
||||
|
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
}
|
||||
|
||||
-- nested cmdline
|
||||
@ -404,6 +412,7 @@ local function test_cmdline(linegrid)
|
||||
{3:[Command Line] }|
|
||||
|
|
||||
]],
|
||||
cmdline = { [2] = { abort = true } },
|
||||
}
|
||||
|
||||
feed('<c-c>')
|
||||
@ -452,6 +461,7 @@ local function test_cmdline(linegrid)
|
||||
cmdline = {
|
||||
{
|
||||
prompt = 'secret:',
|
||||
hl_id = 0,
|
||||
content = { { '******' } },
|
||||
pos = 6,
|
||||
},
|
||||
@ -495,6 +505,7 @@ local function test_cmdline(linegrid)
|
||||
cmdline = {
|
||||
{
|
||||
prompt = '>',
|
||||
hl_id = 0,
|
||||
content = {
|
||||
{ '(', 30 },
|
||||
{ 'a' },
|
||||
@ -797,11 +808,14 @@ local function test_cmdline(linegrid)
|
||||
-- This used to send an invalid event where pos where larger than the total
|
||||
-- length of content. Checked in _handle_cmdline_show.
|
||||
feed('<esc>')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{1:~ }|*3
|
||||
|
|
||||
]])
|
||||
screen:expect({
|
||||
grid = [[
|
||||
^ |
|
||||
{1:~ }|*3
|
||||
|
|
||||
]],
|
||||
cmdline = { { abort = true } },
|
||||
})
|
||||
end)
|
||||
|
||||
it('does not move cursor to curwin #20309', function()
|
||||
@ -827,6 +841,30 @@ local function test_cmdline(linegrid)
|
||||
} },
|
||||
}
|
||||
end)
|
||||
|
||||
it('show prompt hl_id', function()
|
||||
screen:expect([[
|
||||
^ |
|
||||
{1:~ }|*3
|
||||
|
|
||||
]])
|
||||
feed(':echohl Error | call input("Prompt:")<CR>')
|
||||
screen:expect({
|
||||
grid = [[
|
||||
^ |
|
||||
{1:~ }|*3
|
||||
|
|
||||
]],
|
||||
cmdline = {
|
||||
{
|
||||
content = { { '' } },
|
||||
hl_id = 237,
|
||||
pos = 0,
|
||||
prompt = 'Prompt:',
|
||||
},
|
||||
},
|
||||
})
|
||||
end)
|
||||
end
|
||||
|
||||
-- the representation of cmdline and cmdline_block contents changed with ext_linegrid
|
||||
|
@ -47,6 +47,7 @@ describe('ui/ext_messages', function()
|
||||
line ^1 |
|
||||
{1:~ }|*4
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = {
|
||||
{
|
||||
content = { { '\ntest\n[O]k: ', 6, 10 } },
|
||||
@ -75,6 +76,7 @@ describe('ui/ext_messages', function()
|
||||
line ^2 |
|
||||
{1:~ }|*3
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = {
|
||||
{
|
||||
content = { { '\ntest\n[O]k: ', 6, 10 } },
|
||||
@ -109,6 +111,7 @@ describe('ui/ext_messages', function()
|
||||
l{10:i}ne ^2 |
|
||||
{1:~ }|*3
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = {
|
||||
{
|
||||
content = { { 'replace with X (y/n/a/q/l/^E/^Y)?', 6, 18 } },
|
||||
@ -144,6 +147,7 @@ describe('ui/ext_messages', function()
|
||||
line 2 |
|
||||
{1:~ }|*3
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = {
|
||||
{
|
||||
content = { { 'search hit BOTTOM, continuing at TOP', 19, 26 } },
|
||||
@ -155,6 +159,7 @@ describe('ui/ext_messages', function()
|
||||
-- kind=emsg after :throw
|
||||
feed(':throw "foo"<cr>')
|
||||
screen:expect {
|
||||
cmdline = { { abort = false } },
|
||||
messages = {
|
||||
{
|
||||
content = { { 'Error detected while processing :', 9, 6 } },
|
||||
@ -181,6 +186,7 @@ describe('ui/ext_messages', function()
|
||||
^line 2 |
|
||||
{1:~ }|*3
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = {
|
||||
{
|
||||
content = { { '(2 of 2): line2' } },
|
||||
@ -197,6 +203,7 @@ describe('ui/ext_messages', function()
|
||||
line 2 |
|
||||
{1:~ }|*3
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = { {
|
||||
content = { { '?line ' } },
|
||||
kind = 'search_cmd',
|
||||
@ -206,6 +213,7 @@ describe('ui/ext_messages', function()
|
||||
-- highlight
|
||||
feed(':filter character highlight<CR>')
|
||||
screen:expect({
|
||||
cmdline = { { abort = false } },
|
||||
messages = {
|
||||
{
|
||||
content = {
|
||||
@ -276,6 +284,7 @@ describe('ui/ext_messages', function()
|
||||
^ |
|
||||
{1:~ }|*4
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = { {
|
||||
content = { { 'raa', 9, 6 } },
|
||||
kind = 'echoerr',
|
||||
@ -302,6 +311,7 @@ describe('ui/ext_messages', function()
|
||||
^ |
|
||||
{1:~ }|*4
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = {
|
||||
{
|
||||
content = { { 'bork', 9, 6 } },
|
||||
@ -324,6 +334,7 @@ describe('ui/ext_messages', function()
|
||||
^ |
|
||||
{1:~ }|*4
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = {
|
||||
{
|
||||
content = { { 'bork', 9, 6 } },
|
||||
@ -366,6 +377,7 @@ describe('ui/ext_messages', function()
|
||||
cmdline = {
|
||||
{
|
||||
prompt = 'foo> ',
|
||||
hl_id = 0,
|
||||
content = { { '' } },
|
||||
pos = 0,
|
||||
},
|
||||
@ -378,6 +390,7 @@ describe('ui/ext_messages', function()
|
||||
^ |
|
||||
{1:~ }|*4
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
}
|
||||
eq('solution', eval('x'))
|
||||
|
||||
@ -387,6 +400,7 @@ describe('ui/ext_messages', function()
|
||||
^ |
|
||||
{1:~ }|*4
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
msg_history = {
|
||||
{ kind = 'echoerr', content = { { 'raa', 9, 6 } } },
|
||||
{ kind = 'echoerr', content = { { 'bork', 9, 6 } } },
|
||||
@ -419,6 +433,7 @@ describe('ui/ext_messages', function()
|
||||
^ |
|
||||
{1:~ }|*4
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = {
|
||||
{
|
||||
content = { { 'bork\nfail', 9, 6 } },
|
||||
@ -433,6 +448,7 @@ describe('ui/ext_messages', function()
|
||||
^ |
|
||||
{1:~ }|*4
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = {
|
||||
{
|
||||
content = { { 'Press ENTER or type command to continue', 6, 18 } },
|
||||
@ -459,6 +475,7 @@ describe('ui/ext_messages', function()
|
||||
{10:line} 2 |
|
||||
{1:~ }|*3
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = {
|
||||
{ content = { { '/line W [1/2]' } }, kind = 'search_count' },
|
||||
},
|
||||
@ -485,6 +502,7 @@ describe('ui/ext_messages', function()
|
||||
^ |
|
||||
{1:~ }|*4
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = {
|
||||
{ content = { { 'x #1' } }, kind = 'list_cmd' },
|
||||
{ content = { { 'y #2' } }, kind = 'list_cmd' },
|
||||
@ -595,6 +613,7 @@ describe('ui/ext_messages', function()
|
||||
alphpabe^t |
|
||||
{1:~ }|*2
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
msg_history = { {
|
||||
content = { { 'stuff' } },
|
||||
kind = 'echomsg',
|
||||
@ -793,6 +812,7 @@ describe('ui/ext_messages', function()
|
||||
^ |
|
||||
{1:~ }|*4
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = { {
|
||||
content = { { 'howdy' } },
|
||||
kind = 'echomsg',
|
||||
@ -821,6 +841,7 @@ describe('ui/ext_messages', function()
|
||||
^ |
|
||||
{1:~ }|*4
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = { {
|
||||
content = { { 'bork', 9, 6 } },
|
||||
kind = 'echoerr',
|
||||
@ -833,6 +854,7 @@ describe('ui/ext_messages', function()
|
||||
^ |
|
||||
{1:~ }|*4
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = { {
|
||||
content = { { 'xyz' } },
|
||||
kind = 'echo',
|
||||
@ -845,6 +867,7 @@ describe('ui/ext_messages', function()
|
||||
^ |
|
||||
{1:~ }|*4
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = {
|
||||
{
|
||||
content = { { 'E117: Unknown function: nosuchfunction', 9, 6 } },
|
||||
@ -859,6 +882,7 @@ describe('ui/ext_messages', function()
|
||||
^ |
|
||||
{1:~ }|*4
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
msg_history = {
|
||||
{ kind = 'echomsg', content = { { 'howdy' } } },
|
||||
{ kind = '', content = { { 'Type :qa and press <Enter> to exit Nvim' } } },
|
||||
@ -892,11 +916,14 @@ describe('ui/ext_messages', function()
|
||||
}
|
||||
|
||||
feed('<cr>')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{1:~ }|*3
|
||||
|
|
||||
]])
|
||||
screen:expect({
|
||||
grid = [[
|
||||
^ |
|
||||
{1:~ }|*3
|
||||
|
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
})
|
||||
eq(1, eval('&cmdheight'))
|
||||
|
||||
feed(':set cmdheight=0')
|
||||
@ -915,10 +942,15 @@ describe('ui/ext_messages', function()
|
||||
},
|
||||
}
|
||||
feed('<cr>')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{1:~ }|*4
|
||||
]])
|
||||
screen:expect({
|
||||
grid = [[
|
||||
^ |
|
||||
{1:~ }|*4
|
||||
]],
|
||||
cmdline = { {
|
||||
abort = false
|
||||
} },
|
||||
})
|
||||
eq(0, eval('&cmdheight'))
|
||||
end)
|
||||
|
||||
@ -929,6 +961,7 @@ describe('ui/ext_messages', function()
|
||||
^ |
|
||||
{1:~ }|*4
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = {
|
||||
{
|
||||
content = {
|
||||
@ -957,6 +990,7 @@ stack traceback:
|
||||
^ |
|
||||
{1:~ }|*4
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = {
|
||||
{
|
||||
content = {
|
||||
@ -981,6 +1015,7 @@ stack traceback:
|
||||
feed(':map<cr>')
|
||||
|
||||
screen:expect {
|
||||
cmdline = { { abort = false } },
|
||||
messages = {
|
||||
{
|
||||
content = {
|
||||
@ -1101,6 +1136,7 @@ stack traceback:
|
||||
^ |
|
||||
{1:~ }|*4
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = {
|
||||
{ content = { { '\n 1 %a "[No Name]" line 1' } }, kind = 'list_cmd' },
|
||||
},
|
||||
@ -1112,6 +1148,7 @@ stack traceback:
|
||||
^ |
|
||||
{1:~ }|*4
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = {
|
||||
{
|
||||
content = { { 'Press ENTER or type command to continue', 6, 18 } },
|
||||
@ -1853,6 +1890,7 @@ describe('ui/ext_messages', function()
|
||||
type :help iccf{18:<Enter>} for information |
|
||||
|*5
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = {
|
||||
{
|
||||
content = { { 'Press ENTER or type command to continue', 6, 18 } },
|
||||
@ -1935,6 +1973,7 @@ describe('ui/ext_messages', function()
|
||||
{1:~ }|*10
|
||||
{3:[No Name] }|
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = {
|
||||
{ content = { { ' cmdheight=0' } }, kind = 'list_cmd' },
|
||||
},
|
||||
@ -1951,6 +1990,7 @@ describe('ui/ext_messages', function()
|
||||
{1:~ }|*9
|
||||
{3:[No Name] }|
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = {
|
||||
{ content = { { ' laststatus=3' } }, kind = 'list_cmd' },
|
||||
},
|
||||
@ -1971,6 +2011,7 @@ describe('ui/ext_messages', function()
|
||||
{1:~ }|*10
|
||||
{3:[No Name] }|
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = {
|
||||
{ content = { { ' cmdheight=0' } }, kind = 'list_cmd' },
|
||||
},
|
||||
|
@ -79,6 +79,7 @@ end
|
||||
--- @field win_position table<integer,table<string,integer>>
|
||||
--- @field float_pos table<integer,table>
|
||||
--- @field cmdline table<integer,table>
|
||||
--- @field cmdline_hide_level integer?
|
||||
--- @field cmdline_block table[]
|
||||
--- @field hl_groups table<string,integer>
|
||||
--- @field messages table<integer,table>
|
||||
@ -654,6 +655,12 @@ screen:redraw_debug() to show all intermediate screen states.]]
|
||||
end
|
||||
end
|
||||
|
||||
-- Only test the abort state of a cmdline level once.
|
||||
if self.cmdline_hide_level ~= nil then
|
||||
self.cmdline[self.cmdline_hide_level] = nil
|
||||
self.cmdline_hide_level = nil
|
||||
end
|
||||
|
||||
if expected.hl_groups ~= nil then
|
||||
for name, id in pairs(expected.hl_groups) do
|
||||
local expected_hl = attr_state.ids[id]
|
||||
@ -1296,7 +1303,7 @@ function Screen:_handle_popupmenu_hide()
|
||||
self.popupmenu = nil
|
||||
end
|
||||
|
||||
function Screen:_handle_cmdline_show(content, pos, firstc, prompt, indent, level)
|
||||
function Screen:_handle_cmdline_show(content, pos, firstc, prompt, indent, level, hl_id)
|
||||
if firstc == '' then
|
||||
firstc = nil
|
||||
end
|
||||
@ -1320,11 +1327,13 @@ function Screen:_handle_cmdline_show(content, pos, firstc, prompt, indent, level
|
||||
firstc = firstc,
|
||||
prompt = prompt,
|
||||
indent = indent,
|
||||
hl_id = prompt and hl_id,
|
||||
}
|
||||
end
|
||||
|
||||
function Screen:_handle_cmdline_hide(level)
|
||||
self.cmdline[level] = nil
|
||||
function Screen:_handle_cmdline_hide(level, abort)
|
||||
self.cmdline[level] = { abort = abort }
|
||||
self.cmdline_hide_level = level
|
||||
end
|
||||
|
||||
function Screen:_handle_cmdline_special_char(char, shift, level)
|
||||
@ -1468,7 +1477,9 @@ function Screen:_extstate_repr(attr_state)
|
||||
local cmdline = {}
|
||||
for i, entry in pairs(self.cmdline) do
|
||||
entry = shallowcopy(entry)
|
||||
entry.content = self:_chunks_repr(entry.content, attr_state)
|
||||
if entry.content ~= nil then
|
||||
entry.content = self:_chunks_repr(entry.content, attr_state)
|
||||
end
|
||||
cmdline[i] = entry
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user