diff options
Diffstat (limited to 'test/functional/terminal')
| -rw-r--r-- | test/functional/terminal/altscreen_spec.lua | 12 | ||||
| -rw-r--r-- | test/functional/terminal/api_spec.lua | 8 | ||||
| -rw-r--r-- | test/functional/terminal/buffer_spec.lua | 136 | ||||
| -rw-r--r-- | test/functional/terminal/channel_spec.lua | 14 | ||||
| -rw-r--r-- | test/functional/terminal/clipboard_spec.lua | 2 | ||||
| -rw-r--r-- | test/functional/terminal/cursor_spec.lua | 403 | ||||
| -rw-r--r-- | test/functional/terminal/ex_terminal_spec.lua | 12 | ||||
| -rw-r--r-- | test/functional/terminal/highlight_spec.lua | 105 | ||||
| -rw-r--r-- | test/functional/terminal/mouse_spec.lua | 82 | ||||
| -rw-r--r-- | test/functional/terminal/scrollback_spec.lua | 44 | ||||
| -rw-r--r-- | test/functional/terminal/tui_spec.lua | 375 | ||||
| -rw-r--r-- | test/functional/terminal/window_spec.lua | 30 | ||||
| -rw-r--r-- | test/functional/terminal/window_split_tab_spec.lua | 10 |
13 files changed, 758 insertions, 475 deletions
diff --git a/test/functional/terminal/altscreen_spec.lua b/test/functional/terminal/altscreen_spec.lua index 4a61e0203d..839e37f541 100644 --- a/test/functional/terminal/altscreen_spec.lua +++ b/test/functional/terminal/altscreen_spec.lua @@ -35,13 +35,13 @@ describe(':terminal altscreen', function() line6 | line7 | line8 | - {1: } | + ^ | {3:-- TERMINAL --} | ]]) enter_altscreen() screen:expect([[ |*5 - {1: } | + ^ | {3:-- TERMINAL --} | ]]) eq(10, api.nvim_buf_line_count(0)) @@ -68,7 +68,7 @@ describe(':terminal altscreen', function() line6 | line7 | line8 | - {1: } | + ^ | {3:-- TERMINAL --} | ]]) feed('<c-\\><c-n>gg') @@ -103,7 +103,7 @@ describe(':terminal altscreen', function() line14 | line15 | line16 | - {1: } | + ^ | {3:-- TERMINAL --} | ]]) end) @@ -132,7 +132,7 @@ describe(':terminal altscreen', function() screen:expect([[ |*2 rows: 4, cols: 50 | - {1: } | + ^ | {3:-- TERMINAL --} | ]]) end @@ -160,7 +160,7 @@ describe(':terminal altscreen', function() line5 | line6 | line7 | - line8 | + ^line8 | {3:-- TERMINAL --} | ]]) end) diff --git a/test/functional/terminal/api_spec.lua b/test/functional/terminal/api_spec.lua index b550df80c3..a8e5367176 100644 --- a/test/functional/terminal/api_spec.lua +++ b/test/functional/terminal/api_spec.lua @@ -33,7 +33,7 @@ describe('api', function() it('qa! RPC request during insert-mode', function() screen:expect { grid = [[ - {1: } | + ^ | {4:~ }|*4 | {3:-- TERMINAL --} | @@ -45,7 +45,7 @@ describe('api', function() -- Wait for socket creation. screen:expect([[ - {1: } | + ^ | {4:~ }|*4 ]] .. socket_name .. [[ | {3:-- TERMINAL --} | @@ -57,7 +57,7 @@ describe('api', function() tt.feed_data('i[tui] insert-mode') -- Wait for stdin to be processed. screen:expect([[ - [tui] insert-mode{1: } | + [tui] insert-mode^ | {4:~ }|*4 {3:-- INSERT --} | {3:-- TERMINAL --} | @@ -73,7 +73,7 @@ describe('api', function() [tui] insert-mode | [socket 1] this is more t | han 25 columns | - [socket 2] input{1: } | + [socket 2] input^ | {4:~ } | {3:-- INSERT --} | {3:-- TERMINAL --} | diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua index 05258a9e50..4635259e33 100644 --- a/test/functional/terminal/buffer_spec.lua +++ b/test/functional/terminal/buffer_spec.lua @@ -89,7 +89,7 @@ describe(':terminal buffer', function() feed('<c-\\><c-n>') screen:expect([[ tty ready | - {2:^ } | + ^ | |*5 ]]) end) @@ -109,7 +109,7 @@ describe(':terminal buffer', function() feed('<c-\\><c-n>dd') screen:expect([[ tty ready | - {2:^ } | + ^ | |*4 {8:E21: Cannot make changes, 'modifiable' is off} | ]]) @@ -122,7 +122,7 @@ describe(':terminal buffer', function() screen:expect([[ ^tty ready | appended tty ready |*2 - {2: } | + | |*2 :let @a = "appended " . @a | ]]) @@ -142,7 +142,7 @@ describe(':terminal buffer', function() screen:expect([[ ^tty ready | appended tty ready | - {2: } | + | |*3 :put a | ]]) @@ -151,7 +151,7 @@ describe(':terminal buffer', function() screen:expect([[ tty ready | appended tty ready |*2 - {2: } | + | | ^ | :6put a | @@ -198,7 +198,7 @@ describe(':terminal buffer', function() {4:~ }| {5:========== }| rows: 2, cols: 50 | - {2: } | + | {18:========== }| | ]]) @@ -234,7 +234,7 @@ describe(':terminal buffer', function() command('set rightleft') screen:expect([[ ydaer ytt| - {1:a}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + ^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| |*4 {3:-- TERMINAL --} | ]]) @@ -277,7 +277,7 @@ describe(':terminal buffer', function() screen:expect { grid = [[ tty ready | - {2:^ } | + ^ | |*4 {3:-- (terminal) --} | ]], @@ -288,7 +288,7 @@ describe(':terminal buffer', function() screen:expect { grid = [[ tty ready | - {2: } | + | |*4 :let g:x = 17^ | ]], @@ -298,7 +298,7 @@ describe(':terminal buffer', function() screen:expect { grid = [[ tty ready | - {1: } | + ^ | |*4 {3:-- TERMINAL --} | ]], @@ -351,7 +351,7 @@ describe(':terminal buffer', function() end) it('TermRequest synchronization #27572', function() - command('autocmd! nvim_terminal TermRequest') + command('autocmd! nvim.terminal TermRequest') local term = exec_lua([[ _G.input = {} local term = vim.api.nvim_open_term(0, { @@ -378,7 +378,7 @@ describe(':terminal buffer', function() }, exec_lua('return _G.input')) end) - it('no heap-buffer-overflow when using termopen(echo) #3161', function() + it('no heap-buffer-overflow when using jobstart("echo",{term=true}) #3161', function() local testfilename = 'Xtestfile-functional-terminal-buffers_spec' write_file(testfilename, 'aaaaaaaaaaaaaaaaaaaaaaaaaaaa') finally(function() @@ -387,8 +387,8 @@ describe(':terminal buffer', function() feed_command('edit ' .. testfilename) -- Move cursor away from the beginning of the line feed('$') - -- Let termopen() modify the buffer - feed_command('call termopen("echo")') + -- Let jobstart(…,{term=true}) modify the buffer + feed_command([[call jobstart("echo", {'term':v:true})]]) assert_alive() feed_command('bdelete!') end) @@ -400,18 +400,31 @@ describe(':terminal buffer', function() assert_alive() end) - it('truncates number of composing characters to 5', function() + it('truncates the size of grapheme clusters', function() local chan = api.nvim_open_term(0, {}) local composing = ('a̳'):sub(2) - api.nvim_chan_send(chan, 'a' .. composing:rep(8)) + api.nvim_chan_send(chan, 'a' .. composing:rep(20)) retry(nil, nil, function() - eq('a' .. composing:rep(5), api.nvim_get_current_line()) + eq('a' .. composing:rep(14), api.nvim_get_current_line()) end) end) + it('handles extended grapheme clusters', function() + local screen = Screen.new(50, 7) + feed 'i' + local chan = api.nvim_open_term(0, {}) + api.nvim_chan_send(chan, '🏴☠️ yarrr') + screen:expect([[ + 🏴☠️ yarrr^ | + |*5 + {5:-- TERMINAL --} | + ]]) + eq('🏴☠️ yarrr', api.nvim_get_current_line()) + end) + it('handles split UTF-8 sequences #16245', function() local screen = Screen.new(50, 7) - fn.termopen({ testprg('shell-test'), 'UTF-8' }) + fn.jobstart({ testprg('shell-test'), 'UTF-8' }, { term = true }) screen:expect([[ ^å | ref: å̲ | @@ -422,6 +435,19 @@ describe(':terminal buffer', function() ]]) end) + it('handles unprintable chars', function() + local screen = Screen.new(50, 7) + feed 'i' + local chan = api.nvim_open_term(0, {}) + api.nvim_chan_send(chan, '\239\187\191') -- '\xef\xbb\xbf' + screen:expect([[ + {18:<feff>}^ | + |*5 + {5:-- TERMINAL --} | + ]]) + eq('\239\187\191', api.nvim_get_current_line()) + end) + it("handles bell respecting 'belloff' and 'visualbell'", function() local screen = Screen.new(50, 7) local chan = api.nvim_open_term(0, {}) @@ -531,16 +557,19 @@ describe('terminal input', function() '--cmd', 'set notermguicolors', '-c', - 'while 1 | redraw | echo keytrans(getcharstr()) | endwhile', + 'while 1 | redraw | echo keytrans(getcharstr(-1, #{simplify: 0})) | endwhile', }) screen:expect([[ - {1: } | + ^ | {4:~ }|*3 {5:[No Name] 0,0-1 All}| | {3:-- TERMINAL --} | ]]) - for _, key in ipairs({ + local keys = { + '<Tab>', + '<CR>', + '<Esc>', '<M-Tab>', '<M-CR>', '<M-Esc>', @@ -568,18 +597,36 @@ describe('terminal input', function() '<S-End>', '<C-End>', '<End>', - '<C-LeftMouse>', - '<C-LeftRelease>', - '<2-LeftMouse>', - '<2-LeftRelease>', - '<S-RightMouse>', - '<S-RightRelease>', - '<2-RightMouse>', - '<2-RightRelease>', - '<M-MiddleMouse>', - '<M-MiddleRelease>', - '<2-MiddleMouse>', - '<2-MiddleRelease>', + '<C-LeftMouse><0,0>', + '<C-LeftDrag><0,1>', + '<C-LeftRelease><0,1>', + '<2-LeftMouse><0,1>', + '<2-LeftDrag><0,0>', + '<2-LeftRelease><0,0>', + '<M-MiddleMouse><0,0>', + '<M-MiddleDrag><0,1>', + '<M-MiddleRelease><0,1>', + '<2-MiddleMouse><0,1>', + '<2-MiddleDrag><0,0>', + '<2-MiddleRelease><0,0>', + '<S-RightMouse><0,0>', + '<S-RightDrag><0,1>', + '<S-RightRelease><0,1>', + '<2-RightMouse><0,1>', + '<2-RightDrag><0,0>', + '<2-RightRelease><0,0>', + '<S-X1Mouse><0,0>', + '<S-X1Drag><0,1>', + '<S-X1Release><0,1>', + '<2-X1Mouse><0,1>', + '<2-X1Drag><0,0>', + '<2-X1Release><0,0>', + '<S-X2Mouse><0,0>', + '<S-X2Drag><0,1>', + '<S-X2Release><0,1>', + '<2-X2Mouse><0,1>', + '<2-X2Drag><0,0>', + '<2-X2Release><0,0>', '<S-ScrollWheelUp>', '<S-ScrollWheelDown>', '<ScrollWheelUp>', @@ -588,15 +635,22 @@ describe('terminal input', function() '<S-ScrollWheelRight>', '<ScrollWheelLeft>', '<ScrollWheelRight>', - }) do + } + -- FIXME: The escape sequence to enable kitty keyboard mode doesn't work on Windows + if not is_os('win') then + table.insert(keys, '<C-I>') + table.insert(keys, '<C-M>') + table.insert(keys, '<C-[>') + end + for _, key in ipairs(keys) do feed(key) screen:expect(([[ | {4:~ }|*3 {5:[No Name] 0,0-1 All}| - %s{1: }{MATCH: *}| + %s^ {MATCH: *}| {3:-- TERMINAL --} | - ]]):format(key)) + ]]):format(key:gsub('<%d+,%d+>$', ''))) end end) end) @@ -624,7 +678,7 @@ if is_os('win') then > :: appended :: tty ready | > :: tty ready | > :: appended :: tty ready | - ^> {2: } | + ^> | :let @a = @a . "\n:: appended " . @a . "\n\n" | ]]) -- operator count is also taken into consideration @@ -635,7 +689,7 @@ if is_os('win') then > :: appended :: tty ready | > :: tty ready | > :: appended :: tty ready | - ^> {2: } | + ^> | :let @a = @a . "\n:: appended " . @a . "\n\n" | ]]) end) @@ -649,7 +703,7 @@ if is_os('win') then | > :: tty ready | > :: appended :: tty ready | - > {2: } | + > | | ^ | :put a | @@ -662,14 +716,14 @@ if is_os('win') then > :: appended :: tty ready | > :: tty ready | > :: appended :: tty ready | - ^> {2: } | + ^> | :6put a | ]]) end) end) end -describe('termopen()', function() +describe('termopen() (deprecated alias to `jobstart(…,{term=true})`)', function() before_each(clear) it('disallowed when textlocked and in cmdwin buffer', function() diff --git a/test/functional/terminal/channel_spec.lua b/test/functional/terminal/channel_spec.lua index 9912c1ff7b..bb97411f43 100644 --- a/test/functional/terminal/channel_spec.lua +++ b/test/functional/terminal/channel_spec.lua @@ -75,8 +75,8 @@ describe('terminal channel is closed and later released if', function() eq(chans - 1, eval('len(nvim_list_chans())')) end) - it('opened by termopen(), exited, and deleted by pressing a key', function() - command([[let id = termopen('echo')]]) + it('opened by jobstart(…,{term=true}), exited, and deleted by pressing a key', function() + command([[let id = jobstart('echo',{'term':v:true})]]) local chans = eval('len(nvim_list_chans())') -- wait for process to exit screen:expect({ any = '%[Process exited 0%]' }) @@ -96,8 +96,8 @@ describe('terminal channel is closed and later released if', function() end) -- This indirectly covers #16264 - it('opened by termopen(), exited, and deleted by :bdelete', function() - command([[let id = termopen('echo')]]) + it('opened by jobstart(…,{term=true}), exited, and deleted by :bdelete', function() + command([[let id = jobstart('echo', {'term':v:true})]]) local chans = eval('len(nvim_list_chans())') -- wait for process to exit screen:expect({ any = '%[Process exited 0%]' }) @@ -124,7 +124,7 @@ it('chansend sends lines to terminal channel in proper order', function() screen._default_attr_ids = nil local shells = is_os('win') and { 'cmd.exe', 'pwsh.exe -nop', 'powershell.exe -nop' } or { 'sh' } for _, sh in ipairs(shells) do - command([[let id = termopen(']] .. sh .. [[')]]) + command([[let id = jobstart(']] .. sh .. [[', {'term':v:true})]]) command([[call chansend(id, ['echo "hello"', 'echo "world"', ''])]]) screen:expect { any = [[echo "hello".*echo "world"]], @@ -149,7 +149,7 @@ describe('no crash when TermOpen autocommand', function() }) end) - it('processes job exit event when using termopen()', function() + it('processes job exit event when using jobstart(…,{term=true})', function() command([[autocmd TermOpen * call input('')]]) async_meths.nvim_command('terminal foobar') screen:expect { @@ -179,7 +179,7 @@ describe('no crash when TermOpen autocommand', function() assert_alive() end) - it('wipes buffer and processes events when using termopen()', function() + it('wipes buffer and processes events when using jobstart(…,{term=true})', function() command([[autocmd TermOpen * bwipe! | call input('')]]) async_meths.nvim_command('terminal foobar') screen:expect { diff --git a/test/functional/terminal/clipboard_spec.lua b/test/functional/terminal/clipboard_spec.lua index 4a1a0e29fd..f0ce407eaa 100644 --- a/test/functional/terminal/clipboard_spec.lua +++ b/test/functional/terminal/clipboard_spec.lua @@ -56,7 +56,7 @@ describe(':terminal', function() return string.format('\027]52;;%s\027\\', arg) end - fn.termopen({ testprg('shell-test'), '-t', osc52(encoded) }) + fn.jobstart({ testprg('shell-test'), '-t', osc52(encoded) }, { term = true }) retry(nil, 1000, function() eq(text, exec_lua([[ return vim.g.clipboard_data ]])) diff --git a/test/functional/terminal/cursor_spec.lua b/test/functional/terminal/cursor_spec.lua index f223cdd417..83408e41b3 100644 --- a/test/functional/terminal/cursor_spec.lua +++ b/test/functional/terminal/cursor_spec.lua @@ -1,13 +1,12 @@ local t = require('test.testutil') local n = require('test.functional.testnvim')() -local Screen = require('test.functional.ui.screen') local tt = require('test.functional.testterm') local feed, clear = n.feed, n.clear local testprg, command = n.testprg, n.command local eq, eval = t.eq, n.eval local matches = t.matches -local poke_eventloop = n.poke_eventloop +local call = n.call local hide_cursor = tt.hide_cursor local show_cursor = tt.show_cursor local is_os = t.is_os @@ -16,16 +15,27 @@ local skip = t.skip describe(':terminal cursor', function() local screen + local terminal_mode_idx ---@type number + before_each(function() clear() screen = tt.setup_screen() + + if terminal_mode_idx == nil then + for i, v in ipairs(screen._mode_info) do + if v.name == 'terminal' then + terminal_mode_idx = i + end + end + assert(terminal_mode_idx) + end end) it('moves the screen cursor when focused', function() tt.feed_data('testing cursor') screen:expect([[ tty ready | - testing cursor{1: } | + testing cursor^ | |*4 {3:-- TERMINAL --} | ]]) @@ -35,7 +45,7 @@ describe(':terminal cursor', function() feed('<c-\\><c-n>') screen:expect([[ tty ready | - {2:^ } | + ^ | |*5 ]]) end) @@ -49,7 +59,7 @@ describe(':terminal cursor', function() screen:expect([[ {7: 1 }tty ready | {7: 2 }^rows: 6, cols: 46 | - {7: 3 }{2: } | + {7: 3 } | {7: 4 } | {7: 5 } | {7: 6 } | @@ -61,7 +71,7 @@ describe(':terminal cursor', function() screen:expect([[ {7: 1 }tty ready | {7: 2 }^rows: 6, cols: 46 | - {7: 3 }{2: } | + {7: 3 } | {7: 4 } | {7: 5 } | {7: 6 } | @@ -72,7 +82,7 @@ describe(':terminal cursor', function() screen:expect([[ {7: 1 }tty ready | {7: 2 }rows: 6, cols: 46 | - {7: 3 }{1: } | + {7: 3 }^ | {7: 4 } | {7: 5 } | {7: 6 } | @@ -82,8 +92,8 @@ describe(':terminal cursor', function() end) describe('when invisible', function() - it('is not highlighted and is detached from screen cursor', function() - skip(is_os('win')) + it('is not highlighted', function() + skip(is_os('win'), '#31587') hide_cursor() screen:expect([[ tty ready | @@ -93,59 +103,259 @@ describe(':terminal cursor', function() show_cursor() screen:expect([[ tty ready | - {1: } | + ^ | |*4 {3:-- TERMINAL --} | ]]) -- same for when the terminal is unfocused feed('<c-\\><c-n>') hide_cursor() + screen:expect({ + grid = [[ + tty ready | + ^ | + |*5 + ]], + unchanged = true, + }) + show_cursor() + screen:expect({ + grid = [[ + tty ready | + ^ | + |*5 + ]], + unchanged = true, + }) + end) + + it('becomes visible when exiting Terminal mode', function() + skip(is_os('win'), '#31587') + hide_cursor() + screen:expect([[ + tty ready | + |*5 + {3:-- TERMINAL --} | + ]]) + feed('<c-\\><c-n>') screen:expect([[ tty ready | ^ | |*5 ]]) - show_cursor() + feed('i') screen:expect([[ tty ready | - {2:^ } | |*5 + {3:-- TERMINAL --} | ]]) end) end) -end) -describe('cursor with customized highlighting', function() - local screen + it('can be modified by application #3681 #31685', function() + skip(is_os('win'), '#31587') - before_each(function() - clear() - command('highlight TermCursor ctermfg=45 ctermbg=46 cterm=NONE') - command('highlight TermCursorNC ctermfg=55 ctermbg=56 cterm=NONE') - screen = Screen.new(50, 7, { rgb = false }) - screen:set_default_attr_ids({ - [1] = { foreground = 45, background = 46 }, - [2] = { foreground = 55, background = 56 }, - [3] = { bold = true }, + local states = { + [1] = { blink = true, shape = 'block' }, + [2] = { blink = false, shape = 'block' }, + [3] = { blink = true, shape = 'horizontal' }, + [4] = { blink = false, shape = 'horizontal' }, + [5] = { blink = true, shape = 'vertical' }, + [6] = { blink = false, shape = 'vertical' }, + } + + for k, v in pairs(states) do + tt.feed_csi(('%d q'):format(k)) + screen:expect({ + grid = [[ + tty ready | + ^ | + |*4 + {3:-- TERMINAL --} | + ]], + condition = function() + if v.blink then + eq(500, screen._mode_info[terminal_mode_idx].blinkon) + eq(500, screen._mode_info[terminal_mode_idx].blinkoff) + else + eq(0, screen._mode_info[terminal_mode_idx].blinkon) + eq(0, screen._mode_info[terminal_mode_idx].blinkoff) + end + + eq(v.shape, screen._mode_info[terminal_mode_idx].cursor_shape) + + -- Cell percentages are hard coded for each shape in terminal.c + if v.shape == 'horizontal' then + eq(20, screen._mode_info[terminal_mode_idx].cell_percentage) + elseif v.shape == 'vertical' then + eq(25, screen._mode_info[terminal_mode_idx].cell_percentage) + end + end, + }) + end + + feed([[<C-\><C-N>]]) + + screen:expect([[ + tty ready | + ^ | + |*5 + ]]) + + -- Cursor returns to default on TermLeave + eq(500, screen._mode_info[terminal_mode_idx].blinkon) + eq(500, screen._mode_info[terminal_mode_idx].blinkoff) + eq('block', screen._mode_info[terminal_mode_idx].cursor_shape) + end) + + it('can be modified per terminal', function() + skip(is_os('win'), '#31587') + + -- Set cursor to vertical bar with blink + tt.feed_csi('5 q') + screen:expect({ + grid = [[ + tty ready | + ^ | + |*4 + {3:-- TERMINAL --} | + ]], + condition = function() + eq(500, screen._mode_info[terminal_mode_idx].blinkon) + eq(500, screen._mode_info[terminal_mode_idx].blinkoff) + eq('vertical', screen._mode_info[terminal_mode_idx].cursor_shape) + end, + }) + + tt.hide_cursor() + screen:expect({ + grid = [[ + tty ready | + | + |*4 + {3:-- TERMINAL --} | + ]], + condition = function() + eq(500, screen._mode_info[terminal_mode_idx].blinkon) + eq(500, screen._mode_info[terminal_mode_idx].blinkoff) + eq('vertical', screen._mode_info[terminal_mode_idx].cursor_shape) + end, }) - command('call termopen(["' .. testprg('tty-test') .. '"])') + + -- Exit terminal mode to reset terminal cursor settings to default and + -- create a new terminal window + feed([[<C-\><C-N>]]) + command('set statusline=~~~') + command('new') + call('jobstart', { testprg('tty-test') }, { term = true }) feed('i') - poke_eventloop() + screen:expect({ + grid = [[ + tty ready | + ^ | + {17:~~~ }| + rows: 2, cols: 50 | + | + {18:~~~ }| + {3:-- TERMINAL --} | + ]], + condition = function() + -- New terminal, cursor resets to defaults + eq(500, screen._mode_info[terminal_mode_idx].blinkon) + eq(500, screen._mode_info[terminal_mode_idx].blinkoff) + eq('block', screen._mode_info[terminal_mode_idx].cursor_shape) + end, + }) + + -- Set cursor to underline, no blink + tt.feed_csi('4 q') + screen:expect({ + grid = [[ + tty ready | + ^ | + {17:~~~ }| + rows: 2, cols: 50 | + | + {18:~~~ }| + {3:-- TERMINAL --} | + ]], + condition = function() + eq(0, screen._mode_info[terminal_mode_idx].blinkon) + eq(0, screen._mode_info[terminal_mode_idx].blinkoff) + eq('horizontal', screen._mode_info[terminal_mode_idx].cursor_shape) + end, + }) + + -- Switch back to first terminal, cursor should still be hidden + command('wincmd p') + screen:expect({ + grid = [[ + tty ready | + | + {18:~~~ }| + rows: 2, cols: 50 | + | + {17:~~~ }| + {3:-- TERMINAL --} | + ]], + condition = function() + eq(500, screen._mode_info[terminal_mode_idx].blinkon) + eq(500, screen._mode_info[terminal_mode_idx].blinkoff) + eq('vertical', screen._mode_info[terminal_mode_idx].cursor_shape) + end, + }) end) - it('overrides the default highlighting', function() + it('can be positioned arbitrarily', function() + clear() + screen = tt.setup_child_nvim({ + '-u', + 'NONE', + '-i', + 'NONE', + '--cmd', + n.nvim_set .. ' noshowmode', + }) + screen:expect([[ + ^ | + ~ |*4 + | + {3:-- TERMINAL --} | + ]]) + + feed('i<Tab>') screen:expect([[ - tty ready | - {1: } | - |*4 + ^ | + ~ |*4 + | {3:-- TERMINAL --} | ]]) - feed('<c-\\><c-n>') + end) + + it('preserves guicursor value on TermLeave #31612', function() + eq( |