diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2024-12-22 16:06:46 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-22 16:06:46 -0800 |
commit | 7e1c1ff7fcf2cbc564c90a656124b70ad8bb4d5f (patch) | |
tree | a7f30855c9ef3304b0d7664413fcfebccc6b638b /test/functional | |
parent | 665a0e85c4788cb2847e270c333c0aee306f07ad (diff) | |
parent | a10636fbe7bb4dba45c42c64548e5e32fe8f8d12 (diff) | |
download | rneovim-7e1c1ff7fcf2cbc564c90a656124b70ad8bb4d5f.tar.gz rneovim-7e1c1ff7fcf2cbc564c90a656124b70ad8bb4d5f.tar.bz2 rneovim-7e1c1ff7fcf2cbc564c90a656124b70ad8bb4d5f.zip |
Merge #31661 cmdline_show/hide events
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/lua/ui_event_spec.lua | 11 | ||||
-rw-r--r-- | test/functional/ui/cmdline_spec.lua | 62 | ||||
-rw-r--r-- | test/functional/ui/messages_spec.lua | 218 | ||||
-rw-r--r-- | test/functional/ui/screen.lua | 29 |
4 files changed, 251 insertions, 69 deletions
diff --git a/test/functional/lua/ui_event_spec.lua b/test/functional/lua/ui_event_spec.lua index 25cc46e260..7e890e8ae0 100644 --- a/test/functional/lua/ui_event_spec.lua +++ b/test/functional/lua/ui_event_spec.lua @@ -261,9 +261,11 @@ 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 } }, + history = true, kind = 'emsg', }, }, @@ -278,9 +280,11 @@ describe('vim.ui_attach', function() Y)? | {1:~ }| ]], + cmdline = { { abort = false } }, messages = { { content = { { 'replace with Replacement (y/n/a/q/l/^E/^Y)?', 6, 18 } }, + history = true, kind = 'confirm_sub', }, }, @@ -294,13 +298,16 @@ describe('vim.ui_attach', function() e mouse (q or empty cancels): | {1:^~ }| ]], + cmdline = { { abort = false } }, messages = { { content = { { 'Select:\nOne\nTwo\n' } }, + history = false, kind = 'list_cmd', }, { content = { { 'Type number and <Enter> or click with the mouse (q or empty cancels): ' } }, + history = false, kind = 'number_prompt', }, }, @@ -359,6 +366,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 @@ -378,6 +386,7 @@ describe('vim.ui_attach', function() 6, }, }, + history = true, kind = 'lua_error', }, { @@ -388,10 +397,12 @@ describe('vim.ui_attach', function() 6, }, }, + history = true, kind = 'lua_error', }, { content = { { 'Press ENTER or type command to continue', 100, 18 } }, + history = false, kind = 'return_prompt', }, }, diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua index 0221c1e0b0..63764a9b6c 100644 --- a/test/functional/ui/cmdline_spec.lua +++ b/test/functional/ui/cmdline_spec.lua @@ -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 diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua index 8f8795370f..8acf8495c6 100644 --- a/test/functional/ui/messages_spec.lua +++ b/test/functional/ui/messages_spec.lua @@ -47,9 +47,11 @@ describe('ui/ext_messages', function() line ^1 | {1:~ }|*4 ]], + cmdline = { { abort = false } }, messages = { { content = { { '\ntest\n[O]k: ', 6, 10 } }, + history = false, kind = 'confirm', }, }, @@ -75,9 +77,11 @@ describe('ui/ext_messages', function() line ^2 | {1:~ }|*3 ]], + cmdline = { { abort = false } }, messages = { { content = { { '\ntest\n[O]k: ', 6, 10 } }, + history = false, kind = 'confirm', }, }, @@ -87,14 +91,17 @@ describe('ui/ext_messages', function() messages = { { content = { { '\ntest\n[O]k: ', 6, 10 } }, + history = false, kind = 'confirm', }, { content = { { '1' } }, + history = false, kind = 'echo', }, { content = { { 'Press ENTER or type command to continue', 6, 18 } }, + history = false, kind = 'return_prompt', }, }, @@ -109,9 +116,11 @@ 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 } }, + history = true, kind = 'confirm_sub', }, }, @@ -131,6 +140,7 @@ describe('ui/ext_messages', function() messages = { { content = { { 'W10: Warning: Changing a readonly file', 19, 26 } }, + history = true, kind = 'wmsg', }, }, @@ -144,9 +154,11 @@ describe('ui/ext_messages', function() line 2 | {1:~ }|*3 ]], + cmdline = { { abort = false } }, messages = { { content = { { 'search hit BOTTOM, continuing at TOP', 19, 26 } }, + history = true, kind = 'wmsg', }, }, @@ -155,17 +167,21 @@ 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 } }, + history = true, kind = 'emsg', }, { content = { { 'E605: Exception not caught: foo', 9, 6 } }, + history = true, kind = 'emsg', }, { content = { { 'Press ENTER or type command to continue', 6, 18 } }, + history = false, kind = 'return_prompt', }, }, @@ -181,9 +197,11 @@ describe('ui/ext_messages', function() ^line 2 | {1:~ }|*3 ]], + cmdline = { { abort = false } }, messages = { { content = { { '(2 of 2): line2' } }, + history = true, kind = 'quickfix', }, }, @@ -197,15 +215,20 @@ describe('ui/ext_messages', function() line 2 | {1:~ }|*3 ]], - messages = { { - content = { { '?line ' } }, - kind = 'search_cmd', - } }, + cmdline = { { abort = false } }, + messages = { + { + content = { { '?line ' } }, + history = false, + kind = 'search_cmd', + }, + }, }) -- highlight feed(':filter character highlight<CR>') screen:expect({ + cmdline = { { abort = false } }, messages = { { content = { @@ -219,6 +242,7 @@ describe('ui/ext_messages', function() { 'links to', 18, 5 }, { ' SpecialChar' }, }, + history = false, kind = 'list_cmd', }, }, @@ -234,6 +258,7 @@ describe('ui/ext_messages', function() messages = { { content = { { 'Already at oldest change' } }, + history = true, kind = 'undo', }, }, @@ -249,6 +274,7 @@ describe('ui/ext_messages', function() messages = { { content = { { 'Already at newest change' } }, + history = true, kind = 'undo', }, }, @@ -261,6 +287,7 @@ describe('ui/ext_messages', function() messages = { { content = { { 'The only match' } }, + history = false, kind = 'completion', }, }, @@ -276,10 +303,14 @@ describe('ui/ext_messages', function() ^ | {1:~ }|*4 ]], - messages = { { - content = { { 'raa', 9, 6 } }, - kind = 'echoerr', - } }, + cmdline = { { abort = false } }, + messages = { + { + content = { { 'raa', 9, 6 } }, + history = true, + kind = 'echoerr', + }, + }, } -- cmdline in a later input cycle clears error message @@ -302,17 +333,21 @@ describe('ui/ext_messages', function() ^ | {1:~ }|*4 ]], + cmdline = { { abort = false } }, messages = { { content = { { 'bork', 9, 6 } }, + history = true, kind = 'echoerr', }, { content = { { 'fail', 9, 6 } }, + history = true, kind = 'echoerr', }, { content = { { 'Press ENTER or type command to continue', 6, 18 } }, + history = false, kind = 'return_prompt', }, }, @@ -324,21 +359,26 @@ describe('ui/ext_messages', function() ^ | {1:~ }|*4 ]], + cmdline = { { abort = false } }, messages = { { content = { { 'bork', 9, 6 } }, + history = true, kind = 'echoerr', }, { content = { { 'fail', 9, 6 } }, + history = true, kind = 'echoerr', }, { content = { { 'extrafail', 9, 6 } }, + history = true, kind = 'echoerr', }, { content = { { 'Press ENTER or type command to continue', 6, 18 } }, + history = false, kind = 'return_prompt', }, }, @@ -359,13 +399,17 @@ describe('ui/ext_messages', function() ^ | {1:~ }|*4 ]], - messages = { { - content = { { 'problem', 9, 6 } }, - kind = 'echoerr', - } }, + messages = { + { + content = { { 'problem', 9, 6 } }, + history = true, + kind = 'echoerr', + }, + }, cmdline = { { prompt = 'foo> ', + hl_id = 0, content = { { '' } }, pos = 0, }, @@ -378,6 +422,7 @@ describe('ui/ext_messages', function() ^ | {1:~ }|*4 ]], + cmdline = { { abort = false } }, } eq('solution', eval('x')) @@ -387,6 +432,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 } } }, @@ -397,6 +443,7 @@ describe('ui/ext_messages', function() messages = { { content = { { 'Press ENTER or type command to continue', 6, 18 } }, + history = false, kind = 'return_prompt', }, }, @@ -419,9 +466,11 @@ describe('ui/ext_messages', function() ^ | {1:~ }|*4 ]], + cmdline = { { abort = false } }, messages = { { content = { { 'bork\nfail', 9, 6 } }, + history = true, kind = 'echoerr', }, }, @@ -433,9 +482,11 @@ describe('ui/ext_messages', function() ^ | {1:~ }|*4 ]], + cmdline = { { abort = false } }, messages = { { content = { { 'Press ENTER or type command to continue', 6, 18 } }, + history = false, kind = 'return_prompt', }, }, @@ -459,8 +510,9 @@ describe('ui/ext_messages', function() {10:line} 2 | {1:~ }|*3 ]], + cmdline = { { abort = false } }, messages = { - { content = { { '/line W [1/2]' } }, kind = 'search_count' }, + { content = { { '/line W [1/2]' } }, kind = 'search_count', history = false }, }, } @@ -472,7 +524,7 @@ describe('ui/ext_messages', function() {1:~ }|*3 ]], messages = { - { content = { { '/line [2/2]' } }, kind = 'search_count' }, + { content = { { '/line [2/2]' } }, kind = 'search_count', history = false }, }, } end) @@ -485,11 +537,13 @@ describe('ui/ext_messages', function() ^ | {1:~ }|*4 ]], + cmdline = { { abort = false } }, messages = { - { content = { { 'x #1' } }, kind = 'list_cmd' }, - { content = { { 'y #2' } }, kind = 'list_cmd' }, + { content = { { 'x #1' } }, kind = 'list_cmd', history = false }, + { content = { { 'y #2' } }, kind = 'list_cmd', history = false }, { content = { { 'Press ENTER or type command to continue', 6, 18 } }, + history = false, kind = 'return_prompt', }, }, @@ -560,10 +614,13 @@ describe('ui/ext_messages', function() items = { { 'alphpabet', '', '', '' }, { 'alphanum', '', '', '' } }, pos = 1, }, - messages = { { - content = { { 'stuff' } }, - kind = 'echomsg', - } }, + messages = { + { + content = { { 'stuff' } }, + history = true, + kind = 'echomsg', + }, + }, showmode = { { '-- Keyword Local completion (^N^P) ', 5, 11 }, { 'match 1 of 2', 6, 18 } }, } @@ -580,10 +637,13 @@ describe('ui/ext_messages', function() items = { { 'alphpabet', '', '', '' }, { 'alphanum', '', '', '' } }, pos = 0, }, - messages = { { - content = { { 'stuff' } }, - kind = 'echomsg', - } }, + messages = { + { + content = { { 'stuff' } }, + history = true, + kind = 'echomsg', + }, + }, showmode = { { '-- Keyword Local completion (^N^P) ', 5, 11 }, { 'match 2 of 2', 6, 18 } }, } @@ -595,6 +655,7 @@ describe('ui/ext_messages', function() alphpabe^t | {1:~ }|*2 ]], + cmdline = { { abort = false } }, msg_history = { { content = { { 'stuff' } }, kind = 'echomsg', @@ -602,6 +663,7 @@ describe('ui/ext_messages', function() messages = { { content = { { 'Press ENTER or type command to continue', 6, 18 } }, + history = false, kind = 'return_prompt', }, }, @@ -793,10 +855,14 @@ describe('ui/ext_messages', function() ^ | {1:~ }|*4 ]], - messages = { { - content = { { 'howdy' } }, - kind = 'echomsg', - } }, + cmdline = { { abort = false } }, + messages = { + { + content = { { 'howdy' } }, + history = true, + kind = 'echomsg', + }, + }, } -- always test a message without kind. If this one gets promoted to a @@ -810,6 +876,7 @@ describe('ui/ext_messages', function() messages = { { content = { { 'Type :qa and press <Enter> to exit Nvim' } }, + history = true, kind = '', }, }, @@ -821,10 +888,14 @@ describe('ui/ext_messages', function() ^ | {1:~ }|*4 ]], - messages = { { - content = { { 'bork', 9, 6 } }, - kind = 'echoerr', - } }, + cmdline = { { abort = false } }, + messages = { + { + content = { { 'bork', 9, 6 } }, + history = true, + kind = 'echoerr', + }, + }, } feed(':echo "xyz"<cr>') @@ -833,10 +904,14 @@ describe('ui/ext_messages', function() ^ | {1:~ }|*4 ]], - messages = { { - content = { { 'xyz' } }, - kind = 'echo', - } }, + cmdline = { { abort = false } }, + messages = { + { + content = { { 'xyz' } }, + history = false, + kind = 'echo', + }, + }, } feed(':call nosuchfunction()<cr>') @@ -845,9 +920,11 @@ describe('ui/ext_messages', function() ^ | {1:~ }|*4 ]], + cmdline = { { abort = false } }, messages = { { content = { { 'E117: Unknown function: nosuchfunction', 9, 6 } }, + history = true, kind = 'emsg', }, }, @@ -859,6 +936,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' } } }, @@ -868,6 +946,7 @@ describe('ui/ext_messages', function() messages = { { content = { { 'Press ENTER or type command to continue', 6, 18 } }, + history = false, kind = 'return_prompt', }, }, @@ -892,11 +971,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 +997,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 +1016,7 @@ describe('ui/ext_messages', function() ^ | {1:~ }|*4 ]], + cmdline = { { abort = false } }, messages = { { content = { @@ -943,6 +1031,7 @@ stack traceback: 6, }, }, + history = true, kind = 'lua_error', }, }, @@ -957,11 +1046,13 @@ stack traceback: ^ | {1:~ }|*4 ]], + cmdline = { { abort = false } }, messages = { { content = { { "Error invoking 'test_method' on channel 1:\ncomplete\nerror\n\nmessage", 9, 6 }, }, + history = true, kind = 'rpc_error', }, }, @@ -981,6 +1072,7 @@ stack traceback: feed(':map<cr>') screen:expect { + cmdline = { { abort = false } }, messages = { { content = { @@ -988,6 +1080,7 @@ stack traceback: { '*', 18, 1 }, { ' k' }, }, + history = false, kind = 'list_cmd', }, }, @@ -1008,6 +1101,7 @@ stack traceback: messages = { { content = { { 'wildmenu wildmode' } }, + history = false, kind = 'wildlist', }, }, @@ -1035,10 +1129,12 @@ stack traceback: messages = { { content = { { 'Change "helllo" to:\n 1 "Hello"\n 2 "Hallo"\n 3 "Hullo"\n' } }, + history = false, kind = 'list_cmd', }, { content = { { 'Type number and <Enter> or click with the mouse (q or empty cancels): ' } }, + history = false, kind = 'number_prompt', }, }, @@ -1054,14 +1150,17 @@ stack traceback: messages = { { content = { { 'Change "helllo" to:\n 1 "Hello"\n 2 "Hallo"\n 3 "Hullo"\n' } }, + history = false, kind = 'list_cmd', }, { content = { { 'Type number and <Enter> or click with the mouse (q or empty cancels): ' } }, + history = false, kind = 'number_prompt', }, { content = { { '1' } }, + history = false, kind = '', }, }, @@ -1090,6 +1189,7 @@ stack traceback: messages = { { content = { { 'wow, ', 10, 8 }, { 'such\n\nvery ', 9, 6 }, { 'color', 8, 12 } }, + history = true, kind = 'echomsg', }, }, @@ -1101,8 +1201,13 @@ stack traceback: ^ | {1:~ }|*4 ]], + cmdline = { { abort = false } }, messages = { - { content = { { '\n 1 %a "[No Name]" line 1' } }, kind = 'list_cmd' }, + { + content = { { '\n 1 %a "[No Name]" line 1' } }, + kind = 'list_cmd', + history = false, + }, }, } @@ -1112,9 +1217,11 @@ stack traceback: ^ | {1:~ }|*4 ]], + cmdline = { { abort = false } }, messages = { { content = { { 'Press ENTER or type command to continue', 6, 18 } }, + history = false, kind = 'return_prompt', }, }, @@ -1139,7 +1246,11 @@ stack traceback: command('write ' .. fname) screen:expect({ messages = { - { content = { { string.format('"%s" [New] 0L, 0B written', fname) } }, kind = 'bufwrite' }, + { + content = { { string.format('"%s" [New] 0L, 0B written', fname) } }, + kind = 'bufwrite', + history = true, + }, }, }) end) @@ -1166,6 +1277,7 @@ stack traceback: messages = { { content = { { 'foo\nbar\nbaz' } }, + history = true, kind = 'lua_print', }, }, @@ -1179,6 +1291,7 @@ stack traceback: messages = { { content = { { '{\n foo = "bar"\n}' } }, + history = true, kind = 'lua_print', }, }, @@ -1853,9 +1966,11 @@ 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 } }, + history = false, kind = 'return_prompt', }, }, @@ -1935,8 +2050,9 @@ describe('ui/ext_messages', function() {1:~ }|*10 {3:[No Name] }| ]], + cmdline = { { abort = false } }, messages = { - { content = { { ' cmdheight=0' } }, kind = 'list_cmd' }, + { content = { { ' cmdheight=0' } }, kind = 'list_cmd', history = false }, }, }) @@ -1951,8 +2067,9 @@ describe('ui/ext_messages', function() {1:~ }|*9 {3:[No Name] }| ]], + cmdline = { { abort = false } }, messages = { - { content = { { ' laststatus=3' } }, kind = 'list_cmd' }, + { content = { { ' laststatus=3' } }, kind = 'list_cmd', history = false }, }, }) @@ -1971,8 +2088,9 @@ describe('ui/ext_messages', function() {1:~ }|*10 {3:[No Name] }| ]], + cmdline = { { abort = false } }, messages = { - { content = { { ' cmdheight=0' } }, kind = 'list_cmd' }, + { content = { { ' cmdheight=0' } }, kind = 'list_cmd', history = false }, }, }) end) diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua index 42734d07ca..6a8e7df6a0 100644 --- a/test/functional/ui/screen.lua +++ b/test/functional/ui/screen.lua @@ -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) @@ -1360,12 +1369,12 @@ function Screen:_handle_wildmenu_hide() self.wildmenu_items, self.wildmenu_pos = nil, nil end -function Screen:_handle_msg_show(kind, chunks, replace_last) +function Screen:_handle_msg_show(kind, chunks, replace_last, history) local pos = #self.messages if not replace_last or pos == 0 then pos = pos + 1 end - self.messages[pos] = { kind = kind, content = chunks } + self.messages[pos] = { kind = kind, content = chunks, history = history } end function Screen:_handle_msg_clear() @@ -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 @@ -1479,7 +1490,11 @@ function Screen:_extstate_repr(attr_state) local messages = {} for i, entry in ipairs(self.messages) do - messages[i] = { kind = entry.kind, content = self:_chunks_repr(entry.content, attr_state) } + messages[i] = { + kind = entry.kind, + content = self:_chunks_repr(entry.content, attr_state), + history = entry.history, + } end local msg_history = {} |