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(3, screen._mode_info[terminal_mode_idx].hl_id) + + -- Change 'guicursor' while terminal mode is active + command('set guicursor+=t:Error') + + local error_hl_id = call('hlID', 'Error') + + screen:expect({ + condition = function() + eq(error_hl_id, screen._mode_info[terminal_mode_idx].hl_id) + end, + }) + + -- Exit terminal mode + feed([[<C-\><C-N>]]) + screen:expect([[ tty ready | - {2:^ } | + ^ | |*5 ]]) + + eq(error_hl_id, screen._mode_info[terminal_mode_idx].hl_id) end) end) @@ -171,19 +381,10 @@ describe('buffer cursor position is correct in terminal without number column', }, { cols = 70, }) - screen:set_default_attr_ids({ - [1] = { foreground = 253, background = 11 }, - [2] = { reverse = true }, - [3] = { bold = true }, - [4] = { background = 11 }, - }) - -- Also check for real cursor position, as it is used for stuff like input methods - screen._handle_busy_start = function() end - screen._handle_busy_stop = function() end screen:expect([[ |*4 Entering Ex mode. Type "visual" to go to Normal mode. | - :{2:^ } | + :^ | {3:-- TERMINAL --} | ]]) end @@ -200,7 +401,7 @@ describe('buffer cursor position is correct in terminal without number column', screen:expect([[ |*4 Entering Ex mode. Type "visual" to go to Normal mode. | - :aaaaaaaa{2:^ } | + :aaaaaaaa^ | {3:-- TERMINAL --} | ]]) eq({ 6, 9 }, eval('nvim_win_get_cursor(0)')) @@ -208,7 +409,7 @@ describe('buffer cursor position is correct in terminal without number column', screen:expect([[ |*4 Entering Ex mode. Type "visual" to go to Normal mode. | - :aaaaaaa^a{4: } | + :aaaaaaa^a | | ]]) eq({ 6, 8 }, eval('nvim_win_get_cursor(0)')) @@ -219,7 +420,7 @@ describe('buffer cursor position is correct in terminal without number column', screen:expect([[ |*4 Entering Ex mode. Type "visual" to go to Normal mode. | - :aaaaaa{2:^a}a | + :aaaaaa^aa | {3:-- TERMINAL --} | ]]) eq({ 6, 7 }, eval('nvim_win_get_cursor(0)')) @@ -227,7 +428,7 @@ describe('buffer cursor position is correct in terminal without number column', screen:expect([[ |*4 Entering Ex mode. Type "visual" to go to Normal mode. | - :aaaaa^a{4:a}a | + :aaaaa^aaa | | ]]) eq({ 6, 6 }, eval('nvim_win_get_cursor(0)')) @@ -238,7 +439,7 @@ describe('buffer cursor position is correct in terminal without number column', screen:expect([[ |*4 Entering Ex mode. Type "visual" to go to Normal mode. | - :a{2:^a}aaaaaa | + :a^aaaaaaa | {3:-- TERMINAL --} | ]]) eq({ 6, 2 }, eval('nvim_win_get_cursor(0)')) @@ -246,7 +447,7 @@ describe('buffer cursor position is correct in terminal without number column', screen:expect([[ |*4 Entering Ex mode. Type "visual" to go to Normal mode. | - :^a{4:a}aaaaaa | + :^aaaaaaaa | | ]]) eq({ 6, 1 }, eval('nvim_win_get_cursor(0)')) @@ -263,7 +464,7 @@ describe('buffer cursor position is correct in terminal without number column', screen:expect([[ |*4 Entering Ex mode. Type "visual" to go to Normal mode. | - :µµµµµµµµ{2:^ } | + :µµµµµµµµ^ | {3:-- TERMINAL --} | ]]) eq({ 6, 17 }, eval('nvim_win_get_cursor(0)')) @@ -271,7 +472,7 @@ describe('buffer cursor position is correct in terminal without number column', screen:expect([[ |*4 Entering Ex mode. Type "visual" to go to Normal mode. | - :µµµµµµµ^µ{4: } | + :µµµµµµµ^µ | | ]]) eq({ 6, 15 }, eval('nvim_win_get_cursor(0)')) @@ -282,7 +483,7 @@ describe('buffer cursor position is correct in terminal without number column', screen:expect([[ |*4 Entering Ex mode. Type "visual" to go to Normal mode. | - :µµµµµµ{2:^µ}µ | + :µµµµµµ^µµ | {3:-- TERMINAL --} | ]]) eq({ 6, 13 }, eval('nvim_win_get_cursor(0)')) @@ -290,7 +491,7 @@ describe('buffer cursor position is correct in terminal without number column', screen:expect([[ |*4 Entering Ex mode. Type "visual" to go to Normal mode. | - :µµµµµ^µ{4:µ}µ | + :µµµµµ^µµµ | | ]]) eq({ 6, 11 }, eval('nvim_win_get_cursor(0)')) @@ -301,7 +502,7 @@ describe('buffer cursor position is correct in terminal without number column', screen:expect([[ |*4 Entering Ex mode. Type "visual" to go to Normal mode. | - :µ{2:^µ}µµµµµµ | + :µ^µµµµµµµ | {3:-- TERMINAL --} | ]]) eq({ 6, 3 }, eval('nvim_win_get_cursor(0)')) @@ -309,7 +510,7 @@ describe('buffer cursor position is correct in terminal without number column', screen:expect([[ |*4 Entering Ex mode. Type "visual" to go to Normal mode. | - :^µ{4:µ}µµµµµµ | + :^µµµµµµµµ | | ]]) eq({ 6, 1 }, eval('nvim_win_get_cursor(0)')) @@ -326,7 +527,7 @@ describe('buffer cursor position is correct in terminal without number column', screen:expect([[ |*4 Entering Ex mode. Type "visual" to go to Normal mode. | - :µ̳µ̳µ̳µ̳µ̳µ̳µ̳µ̳{2:^ } | + :µ̳µ̳µ̳µ̳µ̳µ̳µ̳µ̳^ | {3:-- TERMINAL --} | ]]) eq({ 6, 33 }, eval('nvim_win_get_cursor(0)')) @@ -334,7 +535,7 @@ describe('buffer cursor position is correct in terminal without number column', screen:expect([[ |*4 Entering Ex mode. Type "visual" to go to Normal mode. | - :µ̳µ̳µ̳µ̳µ̳µ̳µ̳^µ̳{4: } | + :µ̳µ̳µ̳µ̳µ̳µ̳µ̳^µ̳ | | ]]) eq({ 6, 29 }, eval('nvim_win_get_cursor(0)')) @@ -346,7 +547,7 @@ describe('buffer cursor position is correct in terminal without number column', screen:expect([[ |*4 Entering Ex mode. Type "visual" to go to Normal mode. | - :µ̳µ̳µ̳µ̳µ̳µ̳{2:^µ̳}µ̳ | + :µ̳µ̳µ̳µ̳µ̳µ̳^µ̳µ̳ | {3:-- TERMINAL --} | ]]) eq({ 6, 25 }, eval('nvim_win_get_cursor(0)')) @@ -354,7 +555,7 @@ describe('buffer cursor position is correct in terminal without number column', screen:expect([[ |*4 Entering Ex mode. Type "visual" to go to Normal mode. | - :µ̳µ̳µ̳µ̳µ̳^µ̳{4:µ̳}µ̳ | + :µ̳µ̳µ̳µ̳µ̳^µ̳µ̳µ̳ | | ]]) eq({ 6, 21 }, eval('nvim_win_get_cursor(0)')) @@ -366,7 +567,7 @@ describe('buffer cursor position is correct in terminal without number column', screen:expect([[ |*4 Entering Ex mode. Type "visual" to go to Normal mode. | - :µ̳{2:^µ̳}µ̳µ̳µ̳µ̳µ̳µ̳ | + :µ̳^µ̳µ̳µ̳µ̳µ̳µ̳µ̳ | {3:-- TERMINAL --} | ]]) eq({ 6, 5 }, eval('nvim_win_get_cursor(0)')) @@ -374,7 +575,7 @@ describe('buffer cursor position is correct in terminal without number column', screen:expect([[ |*4 Entering Ex mode. Type "visual" to go to Normal mode. | - :^µ̳{4:µ̳}µ̳µ̳µ̳µ̳µ̳µ̳ | + :^µ̳µ̳µ̳µ̳µ̳µ̳µ̳µ̳ | | ]]) eq({ 6, 1 }, eval('nvim_win_get_cursor(0)')) @@ -391,7 +592,7 @@ describe('buffer cursor position is correct in terminal without number column', screen:expect([[ |*4 Entering Ex mode. Type "visual" to go to Normal mode. | - :哦哦哦哦哦哦哦哦{2:^ } | + :哦哦哦哦哦哦哦哦^ | {3:-- TERMINAL --} | ]]) eq({ 6, 25 }, eval('nvim_win_get_cursor(0)')) @@ -399,7 +600,7 @@ describe('buffer cursor position is correct in terminal without number column', screen:expect([[ |*4 Entering Ex mode. Type "visual" to go to Normal mode. | - :哦哦哦哦哦哦哦^哦{4: } | + :哦哦哦哦哦哦哦^哦 | | ]]) eq({ 6, 22 }, eval('nvim_win_get_cursor(0)')) @@ -410,7 +611,7 @@ describe('buffer cursor position is correct in terminal without number column', screen:expect([[ |*4 Entering Ex mode. Type "visual" to go to Normal mode. | - :哦哦哦哦哦哦{2:^哦}哦 | + :哦哦哦哦哦哦^哦哦 | {3:-- TERMINAL --} | ]]) eq({ 6, 19 }, eval('nvim_win_get_cursor(0)')) @@ -418,7 +619,7 @@ describe('buffer cursor position is correct in terminal without number column', screen:expect([[ |*4 Entering Ex mode. Type "visual" to go to Normal mode. | - :哦哦哦哦哦^哦{4:哦}哦 | + :哦哦哦哦哦^哦哦哦 | | ]]) eq({ 6, 16 }, eval('nvim_win_get_cursor(0)')) @@ -429,7 +630,7 @@ describe('buffer cursor position is correct in terminal without number column', screen:expect([[ |*4 Entering Ex mode. Type "visual" to go to Normal mode. | - :哦{2:^哦}哦哦哦哦哦哦 | + :哦^哦哦哦哦哦哦哦 | {3:-- TERMINAL --} | ]]) eq({ 6, 4 }, eval('nvim_win_get_cursor(0)')) @@ -437,7 +638,7 @@ describe('buffer cursor position is correct in terminal without number column', screen:expect([[ |*4 Entering Ex mode. Type "visual" to go to Normal mode. | - :^哦{4:哦}哦哦哦哦哦哦 | + :^哦哦哦哦哦哦哦哦 | | ]]) eq({ 6, 1 }, eval('nvim_win_get_cursor(0)')) @@ -450,7 +651,7 @@ describe('buffer cursor position is correct in terminal without number column', screen:expect([[ |*4 Entering Ex mode. Type "visual" to go to Normal mode. | - :aaaaaaaa {2:^ } | + :aaaaaaaa ^ | {3:-- TERMINAL --} | ]]) matches('^:aaaaaaaa [ ]*$', eval('nvim_get_current_line()')) @@ -459,7 +660,7 @@ describe('buffer cursor position is correct in terminal without number column', screen:expect([[ |*4 Entering Ex mode. Type "visual" to go to Normal mode. | - :aaaaaaaa ^ {4: } | + :aaaaaaaa ^ | | ]]) eq({ 6, 12 }, eval('nvim_win_get_cursor(0)')) @@ -488,30 +689,20 @@ describe('buffer cursor position is correct in terminal with number column', fun }, { cols = 70, }) - screen:set_default_attr_ids({ - [1] = { foreground = 253, background = 11 }, - [2] = { reverse = true }, - [3] = { bold = true }, - [4] = { background = 11 }, - [7] = { foreground = 130 }, - }) - -- Also check for real cursor position, as it is used for stuff like input methods - screen._handle_busy_start = function() end - screen._handle_busy_stop = function() end screen:expect([[ {7: 1 } | {7: 2 } | {7: 3 } | {7: 4 } | {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:{2:^ } | + {7: 6 }:^ | {3:-- TERMINAL --} | ]]) end before_each(function() clear() - command('set number') + command('au TermOpen * set number') end) describe('in a line with no multibyte chars or trailing spaces,', function() @@ -527,7 +718,7 @@ describe('buffer cursor position is correct in terminal with number column', fun {7: 3 } | {7: 4 } | {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:aaaaaaaa{2:^ } | + {7: 6 }:aaaaaaaa^ | {3:-- TERMINAL --} | ]]) eq({ 6, 9 }, eval('nvim_win_get_cursor(0)')) @@ -538,7 +729,7 @@ describe('buffer cursor position is correct in terminal with number column', fun {7: 3 } | {7: 4 } | {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:aaaaaaa^a{4: } | + {7: 6 }:aaaaaaa^a | | ]]) eq({ 6, 8 }, eval('nvim_win_get_cursor(0)')) @@ -552,7 +743,7 @@ describe('buffer cursor position is correct in terminal with number column', fun {7: 3 } | {7: 4 } | {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:aaaaaa{2:^a}a | + {7: 6 }:aaaaaa^aa | {3:-- TERMINAL --} | ]]) eq({ 6, 7 }, eval('nvim_win_get_cursor(0)')) @@ -563,7 +754,7 @@ describe('buffer cursor position is correct in terminal with number column', fun {7: 3 } | {7: 4 } | {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:aaaaa^a{4:a}a | + {7: 6 }:aaaaa^aaa | | ]]) eq({ 6, 6 }, eval('nvim_win_get_cursor(0)')) @@ -577,7 +768,7 @@ describe('buffer cursor position is correct in terminal with number column', fun {7: 3 } | {7: 4 } | {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:a{2:^a}aaaaaa | + {7: 6 }:a^aaaaaaa | {3:-- TERMINAL --} | ]]) eq({ 6, 2 }, eval('nvim_win_get_cursor(0)')) @@ -588,7 +779,7 @@ describe('buffer cursor position is correct in terminal with number column', fun {7: 3 } | {7: 4 } | {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:^a{4:a}aaaaaa | + {7: 6 }:^aaaaaaaa | | ]]) eq({ 6, 1 }, eval('nvim_win_get_cursor(0)')) @@ -608,7 +799,7 @@ describe('buffer cursor position is correct in terminal with number column', fun {7: 3 } | {7: 4 } | {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:µµµµµµµµ{2:^ } | + {7: 6 }:µµµµµµµµ^ | {3:-- TERMINAL --} | ]]) eq({ 6, 17 }, eval('nvim_win_get_cursor(0)')) @@ -619,7 +810,7 @@ describe('buffer cursor position is correct in terminal with number column', fun {7: 3 } | {7: 4 } | {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:µµµµµµµ^µ{4: } | + {7: 6 }:µµµµµµµ^µ | | ]]) eq({ 6, 15 }, eval('nvim_win_get_cursor(0)')) @@ -633,7 +824,7 @@ describe('buffer cursor position is correct in terminal with number column', fun {7: 3 } | {7: 4 } | {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:µµµµµµ{2:^µ}µ | + {7: 6 }:µµµµµµ^µµ | {3:-- TERMINAL --} | ]]) eq({ 6, 13 }, eval('nvim_win_get_cursor(0)')) @@ -644,7 +835,7 @@ describe('buffer cursor position is correct in terminal with number column', fun {7: 3 } | {7: 4 } | {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:µµµµµ^µ{4:µ}µ | + {7: 6 }:µµµµµ^µµµ | | ]]) eq({ 6, 11 }, eval('nvim_win_get_cursor(0)')) @@ -658,7 +849,7 @@ describe('buffer cursor position is correct in terminal with number column', fun {7: 3 } | {7: 4 } | {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:µ{2:^µ}µµµµµµ | + {7: 6 }:µ^µµµµµµµ | {3:-- TERMINAL --} | ]]) eq({ 6, 3 }, eval('nvim_win_get_cursor(0)')) @@ -669,7 +860,7 @@ describe('buffer cursor position is correct in terminal with number column', fun {7: 3 } | {7: 4 } | {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:^µ{4:µ}µµµµµµ | + {7: 6 }:^µµµµµµµµ | | ]]) eq({ 6, 1 }, eval('nvim_win_get_cursor(0)')) @@ -689,7 +880,7 @@ describe('buffer cursor position is correct in terminal with number column', fun {7: 3 } | {7: 4 } | {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:µ̳µ̳µ̳µ̳µ̳µ̳µ̳µ̳{2:^ } | + {7: 6 }:µ̳µ̳µ̳µ̳µ̳µ̳µ̳µ̳^ | {3:-- TERMINAL --} | ]]) eq({ 6, 33 }, eval('nvim_win_get_cursor(0)')) @@ -700,7 +891,7 @@ describe('buffer cursor position is correct in terminal with number column', fun {7: 3 } | {7: 4 } | {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:µ̳µ̳µ̳µ̳µ̳µ̳µ̳^µ̳{4: } | + {7: 6 }:µ̳µ̳µ̳µ̳µ̳µ̳µ̳^µ̳ | | ]]) eq({ 6, 29 }, eval('nvim_win_get_cursor(0)')) @@ -715,7 +906,7 @@ describe('buffer cursor position is correct in terminal with number column', fun {7: 3 } | {7: 4 } | {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:µ̳µ̳µ̳µ̳µ̳µ̳{2:^µ̳}µ̳ | + {7: 6 }:µ̳µ̳µ̳µ̳µ̳µ̳^µ̳µ̳ | {3:-- TERMINAL --} | ]]) eq({ 6, 25 }, eval('nvim_win_get_cursor(0)')) @@ -726,7 +917,7 @@ describe('buffer cursor position is correct in terminal with number column', fun {7: 3 } | {7: 4 } | {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:µ̳µ̳µ̳µ̳µ̳^µ̳{4:µ̳}µ̳ | + {7: 6 }:µ̳µ̳µ̳µ̳µ̳^µ̳µ̳µ̳ | | ]]) eq({ 6, 21 }, eval('nvim_win_get_cursor(0)')) @@ -741,7 +932,7 @@ describe('buffer cursor position is correct in terminal with number column', fun {7: 3 } | {7: 4 } | {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:µ̳{2:^µ̳}µ̳µ̳µ̳µ̳µ̳µ̳ | + {7: 6 }:µ̳^µ̳µ̳µ̳µ̳µ̳µ̳µ̳ | {3:-- TERMINAL --} | ]]) eq({ 6, 5 }, eval('nvim_win_get_cursor(0)')) @@ -752,7 +943,7 @@ describe('buffer cursor position is correct in terminal with number column', fun {7: 3 } | {7: 4 } | {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:^µ̳{4:µ̳}µ̳µ̳µ̳µ̳µ̳µ̳ | + {7: 6 }:^µ̳µ̳µ̳µ̳µ̳µ̳µ̳µ̳ | | ]]) eq({ 6, 1 }, eval('nvim_win_get_cursor(0)')) @@ -772,7 +963,7 @@ describe('buffer cursor position is correct in terminal with number column', fun {7: 3 } | {7: 4 } | {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:哦哦哦哦哦哦哦哦{2:^ } | + {7: 6 }:哦哦哦哦哦哦哦哦^ | {3:-- TERMINAL --} | ]]) eq({ 6, 25 }, eval('nvim_win_get_cursor(0)')) @@ -783,7 +974,7 @@ describe('buffer cursor position is correct in terminal with number column', fun {7: 3 } | {7: 4 } | {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:哦哦哦哦哦哦哦^哦{4: } | + {7: 6 }:哦哦哦哦哦哦哦^哦 | | ]]) eq({ 6, 22 }, eval('nvim_win_get_cursor(0)')) @@ -797,7 +988,7 @@ describe('buffer cursor position is correct in terminal with number column', fun {7: 3 } | {7: 4 } | {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:哦哦哦哦哦哦{2:^哦}哦 | + {7: 6 }:哦哦哦哦哦哦^哦哦 | {3:-- TERMINAL --} | ]]) eq({ 6, 19 }, eval('nvim_win_get_cursor(0)')) @@ -808,7 +999,7 @@ describe('buffer cursor position is correct in terminal with number column', fun {7: 3 } | {7: 4 } | {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:哦哦哦哦哦^哦{4:哦}哦 | + {7: 6 }:哦哦哦哦哦^哦哦哦 | | ]]) eq({ 6, 16 }, eval('nvim_win_get_cursor(0)')) @@ -822,7 +1013,7 @@ describe('buffer cursor position is correct in terminal with number column', fun {7: 3 } | {7: 4 } | {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:哦{2:^哦}哦哦哦哦哦哦 | + {7: 6 }:哦^哦哦哦哦哦哦哦 | {3:-- TERMINAL --} | ]]) eq({ 6, 4 }, eval('nvim_win_get_cursor(0)')) @@ -833,7 +1024,7 @@ describe('buffer cursor position is correct in terminal with number column', fun {7: 3 } | {7: 4 } | {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:^哦{4:哦}哦哦哦哦哦哦 | + {7: 6 }:^哦哦哦哦哦哦哦哦 | | ]]) eq({ 6, 1 }, eval('nvim_win_get_cursor(0)')) @@ -849,7 +1040,7 @@ describe('buffer cursor position is correct in terminal with number column', fun {7: 3 } | {7: 4 } | {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:aaaaaaaa {2:^ } | + {7: 6 }:aaaaaaaa ^ | {3:-- TERMINAL --} | ]]) matches('^:aaaaaaaa [ ]*$', eval('nvim_get_current_line()')) @@ -861,7 +1052,7 @@ describe('buffer cursor position is correct in terminal with number column', fun {7: 3 } | {7: 4 } | {7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. | - {7: 6 }:aaaaaaaa ^ {4: } | + {7: 6 }:aaaaaaaa ^ | | ]]) eq({ 6, 12 }, eval('nvim_win_get_cursor(0)')) diff --git a/test/functional/terminal/ex_terminal_spec.lua b/test/functional/terminal/ex_terminal_spec.lua index 5ebe7bd4fc..c29a1e9cd4 100644 --- a/test/functional/terminal/ex_terminal_spec.lua +++ b/test/functional/terminal/ex_terminal_spec.lua @@ -175,8 +175,8 @@ local function test_terminal_with_fake_shell(backslash) api.nvim_set_option_value('shellxquote', '', {}) -- win: avoid extra quotes end) - it('with no argument, acts like termopen()', function() - command('autocmd! nvim_terminal TermClose') + it('with no argument, acts like jobstart(…,{term=true})', function() + command('autocmd! nvim.terminal TermClose') feed_command('terminal') screen:expect([[ ^ready $ | @@ -196,7 +196,7 @@ local function test_terminal_with_fake_shell(backslash) ]]) end) - it("with no argument, but 'shell' has arguments, acts like termopen()", function() + it("with no argument, but 'shell' has arguments, acts like jobstart(…,{term=true})", function() api.nvim_set_option_value('shell', shell_path .. ' INTERACT', {}) feed_command('terminal') screen:expect([[ @@ -246,7 +246,7 @@ local function test_terminal_with_fake_shell(backslash) end) it('ignores writes if the backing stream closes', function() - command('autocmd! nvim_terminal TermClose') + command('autocmd! nvim.terminal TermClose') feed_command('terminal') feed('iiXXXXXXX') poke_eventloop() @@ -258,14 +258,14 @@ local function test_terminal_with_fake_shell(backslash) end) it('works with findfile()', function() - command('autocmd! nvim_terminal TermClose') + command('autocmd! nvim.terminal TermClose') feed_command('terminal') eq('term://', string.match(eval('bufname("%")'), '^term://')) eq('scripts/shadacat.py', eval('findfile("scripts/shadacat.py", ".")')) end) it('works with :find', function() - command('autocmd! nvim_terminal TermClose') + command('autocmd! nvim.terminal TermClose') feed_command('terminal') screen:expect([[ ^ready $ | diff --git a/test/functional/terminal/highlight_spec.lua b/test/functional/terminal/highlight_spec.lua index 7822a27b93..0afbd010f7 100644 --- a/test/functional/terminal/highlight_spec.lua +++ b/test/functional/terminal/highlight_spec.lua @@ -6,7 +6,6 @@ local tt = require('test.functional.testterm') local feed, clear = n.feed, n.clear local api = n.api local testprg, command = n.testprg, n.command -local nvim_prog_abs = n.nvim_prog_abs local fn = n.fn local nvim_set = n.nvim_set local is_os = t.is_os @@ -33,11 +32,11 @@ describe(':terminal highlight', function() [12] = { bold = true, underdouble = true }, [13] = { italic = true, undercurl = true }, }) - command(("enew | call termopen(['%s'])"):format(testprg('tty-test'))) + command(("enew | call jobstart(['%s'], {'term':v:true})"):format(testprg('tty-test'))) feed('i') screen:expect([[ tty ready | - {10: } | + ^ | |*4 {5:-- TERMINAL --} | ]]) @@ -61,7 +60,7 @@ describe(':terminal highlight', function() skip(is_os('win')) screen:expect(sub([[ tty ready | - {NUM:text}text{10: } | + {NUM:text}text^ | |*4 {5:-- TERMINAL --} | ]])) @@ -84,7 +83,7 @@ describe(':terminal highlight', function() line6 | line7 | line8 | - {10: } | + ^ | {5:-- TERMINAL --} | ]]) feed('<c-\\><c-n>gg') @@ -150,8 +149,8 @@ it(':terminal highlight has lower precedence than editor #9964', function() }, }) -- Child nvim process in :terminal (with cterm colors). - fn.termopen({ - nvim_prog_abs(), + fn.jobstart({ + n.nvim_prog, '-n', '-u', 'NORC', @@ -163,6 +162,7 @@ it(':terminal highlight has lower precedence than editor #9964', function() '+norm! ichild nvim', '+norm! oline 2', }, { + term = true, env = { VIMRUNTIME = os.getenv('VIMRUNTIME'), }, @@ -195,12 +195,12 @@ it('CursorLine and CursorColumn work in :terminal buffer in Normal mode', functi local screen = Screen.new(50, 7) screen:set_default_attr_ids({ [1] = { background = Screen.colors.Grey90 }, -- CursorLine, CursorColumn - [2] = { reverse = true }, -- TermCursor + [2] = { reverse = true }, [3] = { bold = true }, -- ModeMsg [4] = { background = Screen.colors.Grey90, reverse = true }, [5] = { background = Screen.colors.Red }, }) - command(("enew | call termopen(['%s'])"):format(testprg('tty-test'))) + command(("enew | call jobstart(['%s'], {'term':v:true})"):format(testprg('tty-test'))) screen:expect([[ ^tty ready | |*6 @@ -234,7 +234,7 @@ it('CursorLine and CursorColumn work in :terminal buffer in Normal mode', functi foobar foobar foobar foobar foobar foobar foobar f| oobar foobar foobar foobar foobar foobar foobar fo| obar foobar foobar foobar foobar foobar foobar foo| - bar foobar{2: } | + bar foobar^ | {3:-- TERMINAL --} | ]]) -- Leaving terminal mode restores old values. @@ -248,46 +248,60 @@ it('CursorLine and CursorColumn work in :terminal buffer in Normal mode', functi {1:bar fooba^r }| | ]]) - -- CursorLine and CursorColumn are combined with TermCursorNC. - command('highlight TermCursorNC gui=reverse') + + -- Skip the rest of these tests on Windows #31587 + if is_os('win') then + return + end + + -- CursorLine and CursorColumn are combined with terminal colors. + tt.set_reverse() + tt.feed_data(' foobar') + tt.clear_attrs() screen:expect([[ tty ready{1: } | foobar f{1:o}obar foobar foobar foobar foobar foobar | foobar fo{1:o}bar foobar foobar foobar foobar foobar f| oobar foo{1:b}ar foobar foobar foobar foobar foobar fo| obar foob{1:a}r foobar foobar foobar foobar foobar foo| - {1:bar fooba^r}{4: }{1: }| + {1:bar fooba^r}{4: foobar}{1: }| | ]]) - feed('2gg11|') + feed('2gg15|') screen:expect([[ - tty ready {1: } | - {1: foobar fo^obar foobar foobar foobar foobar foobar }| - foobar foo{1:b}ar foobar foobar foobar foobar foobar f| - oobar foob{1:a}r foobar foobar foobar foobar foobar fo| - obar fooba{1:r} foobar foobar foobar foobar foobar foo| - bar foobar{4: } | + tty ready {1: } | + {1: foobar foobar^ foobar foobar foobar foobar foobar }| + foobar foobar {1:f}oobar foobar foobar foobar foobar f| + oobar foobar f{1:o}obar foobar foobar foobar foobar fo| + obar foobar fo{1:o}bar foobar foobar foobar foobar foo| + bar foobar{2: foo}{4:b}{2:ar} | | ]]) - -- TermCursorNC has higher precedence. - command('highlight TermCursorNC gui=NONE guibg=Red') + + -- Set bg color to red + tt.feed_csi('48;2;255:0:0m') + tt.feed_data(' foobar') + tt.clear_attrs() + feed('2gg20|') + + -- Terminal color has higher precedence screen:expect([[ - tty ready {1: } | - {1: foobar fo^obar foobar foobar foobar foobar foobar }| - foobar foo{1:b}ar foobar foobar foobar foobar foobar f| - oobar foob{1:a}r foobar foobar foobar foobar foobar fo| - obar fooba{1:r} foobar foobar foobar foobar foobar foo| - bar foobar{5: } | + tty ready {1: } | + {1: foobar foobar foob^ar foobar foobar foobar foobar }| + foobar foobar fooba{1:r} foobar foobar foobar foobar f| + oobar foobar foobar{1: }foobar foobar foobar foobar fo| + obar foobar foobar {1:f}oobar foobar foobar foobar foo| + bar foobar{2: foobar}{5: foobar} | | ]]) feed('G$') screen:expect([[ - tty ready{1: } | - foobar f{1:o}obar foobar foobar foobar foobar foobar | - foobar fo{1:o}bar foobar foobar foobar foobar foobar f| - oobar foo{1:b}ar foobar foobar foobar foobar foobar fo| - obar foob{1:a}r foobar foobar foobar foobar foobar foo| - {1:bar fooba^r}{5: }{1: }| + tty ready {1: } | + foobar foobar foobar f{1:o}obar foobar foobar foobar | + foobar foobar foobar fo{1:o}bar foobar foobar foobar f| + oobar foobar foobar foo{1:b}ar foobar foobar foobar fo| + obar foobar foobar foob{1:a}r foobar foobar foobar foo| + {1:bar foobar}{4: foobar}{5: fooba^r}{1: }| | ]]) end) @@ -300,18 +314,17 @@ describe(':terminal highlight forwarding', function() screen = Screen.new(50, 7) screen:set_rgb_cterm(true) screen:set_default_attr_ids({ - [1] = { { reverse = true }, { reverse = true } }, - [2] = { { bold = true }, { bold = true } }, - [3] = { { fg_indexed = true, foreground = tonumber('0xe0e000') }, { foreground = 3 } }, - [4] = { { foreground = tonumber('0xff8000') }, {} }, + [1] = { { bold = true }, { bold = true } }, + [2] = { { fg_indexed = true, foreground = tonumber('0xe0e000') }, { foreground = 3 } }, + [3] = { { foreground = tonumber('0xff8000') }, {} }, }) - command(("enew | call termopen(['%s'])"):format(testprg('tty-test'))) + command(("enew | call jobstart(['%s'], {'term':v:true})"):format(testprg('tty-test'))) feed('i') screen:expect([[ tty ready | - {1: } | + ^ | |*4 - {2:-- TERMINAL --} | + {1:-- TERMINAL --} | ]]) end) @@ -326,9 +339,9 @@ describe(':terminal highlight forwarding', function() screen:expect { grid = [[ tty ready | - {3:text}{4:color}text{1: } | + {2:text}{3:color}text^ | |*4 - {2:-- TERMINAL --} | + {1:-- TERMINAL --} | ]], } end) @@ -351,11 +364,11 @@ describe(':terminal highlight with custom palette', function() [9] = { bold = true }, }) api.nvim_set_var('terminal_color_3', '#123456') - command(("enew | call termopen(['%s'])"):format(testprg('tty-test'))) + command(("enew | call jobstart(['%s'], {'term':v:true})"):format(testprg('tty-test'))) feed('i') screen:expect([[ tty ready | - {7: } | + ^ | |*4 {9:-- TERMINAL --} | ]]) @@ -369,7 +382,7 @@ describe(':terminal highlight with custom palette', function() tt.feed_data('text') screen:expect([[ tty ready | - {1:text}text{7: } | + {1:text}text^ | |*4 {9:-- TERMINAL --} | ]]) diff --git a/test/functional/terminal/mouse_spec.lua b/test/functional/terminal/mouse_spec.lua index 38d6b83417..5898484449 100644 --- a/test/functional/terminal/mouse_spec.lua +++ b/test/functional/terminal/mouse_spec.lua @@ -32,7 +32,7 @@ describe(':terminal mouse', function() line28 | line29 | line30 | - {1: } | + ^ | {3:-- TERMINAL --} | ]]) end) @@ -107,7 +107,7 @@ describe(':terminal mouse', function() line29 | line30 | mouse enabled | - {1: } | + ^ | {3:-- TERMINAL --} | ]]) end) @@ -121,7 +121,7 @@ describe(':terminal mouse', function() line29 | line30 | mouse enabled | - "#{1: } | + "#^ | {3:-- TERMINAL --} | ]]) feed('<LeftDrag><2,2>') @@ -131,7 +131,7 @@ describe(':terminal mouse', function() line29 | line30 | mouse enabled | - @##{1: } | + @##^ | {3:-- TERMINAL --} | ]]) feed('<LeftDrag><3,2>') @@ -141,7 +141,7 @@ describe(':terminal mouse', function() line29 | line30 | mouse enabled | - @$#{1: } | + @$#^ | {3:-- TERMINAL --} | ]]) feed('<LeftRelease><3,2>') @@ -151,7 +151,7 @@ describe(':terminal mouse', function() line29 | line30 | mouse enabled | - #$#{1: } | + #$#^ | {3:-- TERMINAL --} | ]]) end) @@ -165,7 +165,7 @@ describe(':terminal mouse', function() line29 | line30 | mouse enabled | - `!!{1: } | + `!!^ | {3:-- TERMINAL --} | ]]) end) @@ -179,7 +179,7 @@ describe(':terminal mouse', function() line29 | line30 | mouse enabled | - "#{1: } | + "#^ | {3:-- TERMINAL --} | ]]) feed('<ScrollWheelUp><1,2>') @@ -189,7 +189,7 @@ describe(':terminal mouse', function() line29 | line30 | mouse enabled | - `"#{1: } | + `"#^ | {3:-- TERMINAL --} | ]]) feed('<LeftDrag><2,2>') @@ -199,7 +199,7 @@ describe(':terminal mouse', function() line29 | line30 | mouse enabled | - @##{1: } | + @##^ | {3:-- TERMINAL --} | ]]) feed('<ScrollWheelUp><2,2>') @@ -209,7 +209,7 @@ describe(':terminal mouse', function() line29 | line30 | mouse enabled | - `##{1: } | + `##^ | {3:-- TERMINAL --} | ]]) feed('<LeftRelease><2,2>') @@ -219,7 +219,7 @@ describe(':terminal mouse', function() line29 | line30 | mouse enabled | - ###{1: } | + ###^ | {3:-- TERMINAL --} | ]]) end) @@ -237,7 +237,7 @@ describe(':terminal mouse', function() {7: 13 }line30 | {7: 14 }mouse enabled | {7: 15 }rows: 6, cols: 46 | - {7: 16 }{2: } | + {7: 16 } | | ]]) -- If click on the coordinate (0,1) of the region of the terminal @@ -249,7 +249,7 @@ describe(':terminal mouse', function() {7: 13 }line30 | {7: 14 }mouse enabled | {7: 15 }rows: 6, cols: 46 | - {7: 16 } !"{1: } | + {7: 16 } !"^ | {3:-- TERMINAL --} | ]]) end) @@ -261,7 +261,7 @@ describe(':terminal mouse', function() line30 | mouse enabled | rows: 5, cols: 50 | - {1: } | + ^ | ========== | {3:-- TERMINAL --} | ]]) @@ -271,7 +271,7 @@ describe(':terminal mouse', function() line30 | mouse enabled | rows: 5, cols: 50 | - {2:^ } | + ^ | ========== | | ]]) @@ -280,7 +280,7 @@ describe(':terminal mouse', function() mouse enabled | rows: 5, cols: 50 | rows: 4, cols: 50 | - {2:^ } | + ^ | ========== | |*2 ]]) @@ -293,7 +293,7 @@ describe(':terminal mouse', function() line30 │{4:~ }| mouse enabled │{4:~ }| rows: 5, cols: 24 │{4:~ }| - {1: } │{4:~ }| + ^ │{4:~ }| ========== ========== | {3:-- TERMINAL --} | ]]) @@ -303,7 +303,7 @@ describe(':terminal mouse', function() line30 │{4:~ }| mouse enabled │{4:~ }| rows: 5, cols: 24 │{4:~ }| - {2:^ } │{4:~ }| + ^ │{4:~ }| ========== ========== | | ]]) @@ -313,7 +313,7 @@ describe(':terminal mouse', function() mouse enabled │{4:~ }| rows: 5, cols: 24 │{4:~ }| rows: 5, cols: 23 │{4:~ }| - {2:^ } │{4:~ }| + ^ │{4:~ }| ========== ========== | | ]]) @@ -327,7 +327,7 @@ describe(':terminal mouse', function() line30 | mouse enabled | rows: 5, cols: 50 | - {1: } | + ^ | {3:-- TERMINAL --} | ]]) feed('<LeftMouse><0,0>') @@ -337,7 +337,7 @@ describe(':terminal mouse', function() line30 | mouse enabled | rows: 5, cols: 50 | - {2:^ } | + ^ | | ]]) command('set showtabline=2 tabline=TABLINE | startinsert') @@ -347,7 +347,7 @@ describe(':terminal mouse', function() mouse enabled | rows: 5, cols: 50 | rows: 4, cols: 50 | - {1: } | + ^ | {3:-- TERMINAL --} | ]]) feed('<LeftMouse><0,0>') @@ -357,7 +357,7 @@ describe(':terminal mouse', function() mouse enabled | rows: 5, cols: 50 | rows: 4, cols: 50 | - {2:^ } | + ^ | | ]]) command('setlocal winbar= | startinsert') @@ -367,7 +367,7 @@ describe(':terminal mouse', function() rows: 5, cols: 50 | rows: 4, cols: 50 | rows: 5, cols: 50 | - {1: } | + ^ | {3:-- TERMINAL --} | ]]) feed('<LeftMouse><0,0>') @@ -377,7 +377,7 @@ describe(':terminal mouse', function() rows: 5, cols: 50 | rows: 4, cols: 50 | rows: 5, cols: 50 | - {2:^ } | + ^ | | ]]) end) @@ -391,7 +391,7 @@ describe(':terminal mouse', function() line29 │line29 | line30 │line30 | rows: 5, cols: 25 │rows: 5, cols: 25 | - {2:^ } │{2: } | + ^ │ | ========== ========== | :vsp | ]]) @@ -401,7 +401,7 @@ describe(':terminal mouse', function() {4:~ }│line30 | {4:~ }│rows: 5, cols: 25 | {4:~ }│rows: 5, cols: 24 | - {4:~ }│{2: } | + {4:~ }│ | ========== ========== | :enew | set number | ]]) @@ -411,7 +411,7 @@ describe(':terminal mouse', function() {7: 28 }line │line30 | {7: 29 }line │rows: 5, cols: 25 | {7: 30 }line │rows: 5, cols: 24 | - {7: 31 }^ │{2: } | + {7: 31 }^ │ | ========== ========== | | ]]) @@ -421,7 +421,7 @@ describe(':terminal mouse', function() {7: 28 }line │line30 | {7: 29 }line │rows: 5, cols: 25 | {7: 30 }line │rows: 5, cols: 24 | - {7: 31 } │{1: } | + {7: 31 } │^ | ========== ========== | {3:-- TERMINAL --} | ]]) @@ -434,7 +434,7 @@ describe(':terminal mouse', function() {7: 28 }line │rows: 5, cols: 25 | {7: 29 }line │rows: 5, cols: 24 | {7: 30 }line │mouse enabled | - {7: 31 } │{1: } | + {7: 31 } │^ | ========== ========== | {3:-- TERMINAL --} | ]]) @@ -447,7 +447,7 @@ describe(':terminal mouse', function() {7: 22 }line │rows: 5, cols: 25 | {7: 23 }line │rows: 5, cols: 24 | {7: 24 }line │mouse enabled | - {7: 25 }line │{1: } | + {7: 25 }line │^ | ========== ========== | {3:-- TERMINAL --} | ]]) @@ -457,7 +457,7 @@ describe(':terminal mouse', function() {7: 27 }line │rows: 5, cols: 25 | {7: 28 }line │rows: 5, cols: 24 | {7: 29 }line │mouse enabled | - {7: 30 }line │{1: } | + {7: 30 }line │^ | ========== ========== | {3:-- TERMINAL --} | ]]) @@ -468,7 +468,7 @@ describe(':terminal mouse', function() {7: 17 }line │rows: 5, cols: 25 | {7: 18 }line │rows: 5, cols: 24 | {7: 19 }line │mouse enabled | - {7: 20 }line │{1: } | + {7: 20 }line │^ | ========== ========== | {3:-- TERMINAL --} | ]]) @@ -483,7 +483,7 @@ describe(':terminal mouse', function() {7: 2 }linelinelinelineline │rows: 5, cols: 25 | {7: 3 }linelinelinelineline │rows: 5, cols: 24 | {7: 4 }linelinelinelineline │mouse enabled | - {7: 5 }linelinelinelineline │{1: } | + {7: 5 }linelinelinelineline │^ | ========== ========== | {3:-- TERMINAL --} | ]]) @@ -493,7 +493,7 @@ describe(':terminal mouse', function() {7: 2 }nelinelineline │rows: 5, cols: 25 | {7: 3 }nelinelineline │rows: 5, cols: 24 | {7: 4 }nelinelineline │mouse enabled | - {7: 5 }nelinelineline │{1: } | + {7: 5 }nelinelineline │^ | ========== ========== | {3:-- TERMINAL --} | ]]) @@ -504,7 +504,7 @@ describe(':terminal mouse', function() {7: 2 }nelinelinelineline │rows: 5, cols: 25 | {7: 3 }nelinelinelineline │rows: 5, cols: 24 | {7: 4 }nelinelinelineline │mouse enabled | - {7: 5 }nelinelinelineline │{1: } | + {7: 5 }nelinelinelineline │^ | ========== ========== | {3:-- TERMINAL --} | ]]) @@ -517,7 +517,7 @@ describe(':terminal mouse', function() {7: 28 }l^ine │rows: 5, cols: 25 | {7: 29 }line │rows: 5, cols: 24 | {7: 30 }line │mouse enabled | - {7: 31 } │{2: } | + {7: 31 } │ | ========== ========== | | ]]) @@ -531,7 +531,7 @@ describe(':terminal mouse', function() {7: 28 }line │rows: 5, cols: 25 | {7: 29 }line │rows: 5, cols: 24 | {7: 30 }line │mouse enabled | - {7: 31 }^ │{2: } | + {7: 31 }^ │ | ========== ========== | | ]]) @@ -541,7 +541,7 @@ describe(':terminal mouse', function() rows: 5, cols: 24 │rows: 5, cols: 24 | mouse enabled │mouse enabled | rows: 5, cols: 25 │rows: 5, cols: 25 | - {2:^ } │{2: } | + ^ │ | ========== ========== | :bn | ]]) @@ -551,7 +551,7 @@ describe(':terminal mouse', function() {7: 28 }line │mouse enabled | {7: 29 }line │rows: 5, cols: 25 | {7: 30 }line │rows: 5, cols: 24 | - {7: 31 }^ │{2: } | + {7: 31 }^ │ | ========== ========== | :bn | ]]) diff --git a/test/functional/terminal/scrollback_spec.lua b/test/functional/terminal/scrollback_spec.lua index 1751db1aa9..804c5367eb 100644 --- a/test/functional/terminal/scrollback_spec.lua +++ b/test/functional/terminal/scrollback_spec.lua @@ -39,7 +39,7 @@ describe(':terminal scrollback', function() line28 | line29 | line30 | - {1: } | + ^ | {3:-- TERMINAL --} | ]]) end) @@ -67,7 +67,7 @@ describe(':terminal scrollback', function() line2 | line3 | line4 | - {1: } | + ^ | {3:-- TERMINAL --} | ]]) end) @@ -84,7 +84,7 @@ describe(':terminal scrollback', function() line3 | line4 | line5 | - {1: } | + ^ | {3:-- TERMINAL --} | ]]) eq(7, api.nvim_buf_line_count(0)) @@ -102,7 +102,7 @@ describe(':terminal scrollback', function() line5 | line6 | line7 | - line8{1: } | + line8^ | {3:-- TERMINAL --} | ]]) @@ -135,7 +135,7 @@ describe(':terminal scrollback', function() line5 | line6 | line7 | - ^line8{2: } | + ^line8 | | ]]) end) @@ -151,7 +151,7 @@ describe(':terminal scrollback', function() line3 | line4 | rows: 5, cols: 28 | - {2:^ } | + ^ | | ]]) end @@ -168,7 +168,7 @@ describe(':terminal scrollback', function() screen:expect([[ rows: 5, cols: 28 | rows: 3, cols: 26 | - {2:^ } | + ^ | | ]]) eq(8, api.nvim_buf_line_count(0)) @@ -201,7 +201,7 @@ describe(':terminal scrollback', function() screen:expect([[ tty ready | rows: 4, cols: 30 | - {1: } | + ^ | | {3:-- TERMINAL --} | ]]) @@ -220,7 +220,7 @@ describe(':terminal scrollback', function() screen:expect([[ rows: 4, cols: 30 | rows: 3, cols: 30 | - {1: } | + ^ | {3:-- TERMINAL --} | ]]) eq(4, api.nvim_buf_line_count(0)) @@ -235,7 +235,7 @@ describe(':terminal scrollback', function() screen:expect([[ rows: 4, cols: 30 | rows: 3, cols: 30 | - {1: } | + ^ | {3:-- TERMINAL --} | ]]) end) @@ -252,14 +252,14 @@ describe(':terminal scrollback', function() line2 | line3 | line4 | - {1: } | + ^ | {3:-- TERMINAL --} | ]]) screen:try_resize(screen._width, screen._height - 3) screen:expect([[ line4 | rows: 3, cols: 30 | - {1: } | + ^ | {3:-- TERMINAL --} | ]]) eq(7, api.nvim_buf_line_count(0)) @@ -278,7 +278,7 @@ describe(':terminal scrollback', function() line4 | rows: 3, cols: 30 | rows: 4, cols: 30 | - {1: } | + ^ | {3:-- TERMINAL --} | ]]) end @@ -300,7 +300,7 @@ describe(':terminal scrollback', function() rows: 3, cols: 30 | rows: 4, cols: 30 | rows: 7, cols: 30 | - {1: } | + ^ | {3:-- TERMINAL --} | ]]) eq(9, api.nvim_buf_line_count(0)) @@ -337,7 +337,7 @@ describe(':terminal scrollback', function() rows: 4, cols: 30 | rows: 7, cols: 30 | rows: 11, cols: 30 | - {1: } | + ^ | | {3:-- TERMINAL --} | ]]) @@ -355,14 +355,16 @@ describe(':terminal prints more lines than the screen height and exits', functio it('will push extra lines to scrollback', function() clear() local screen = Screen.new(30, 7, { rgb = false }) - command(("call termopen(['%s', '10']) | startinsert"):format(testprg('tty-test'))) + command( + ("call jobstart(['%s', '10'], {'term':v:true}) | startinsert"):format(testprg('tty-test')) + ) screen:expect([[ line6 | line7 | line8 | line9 | | - [Process exited 0]{2: } | + [Process exited 0]^ | {5:-- TERMINAL --} | ]]) feed('<cr>') @@ -454,7 +456,7 @@ describe("'scrollback' option", function() 39: line | 40: line | | - ${1: } | + $^ | {3:-- TERMINAL --} | ]], } @@ -493,7 +495,7 @@ describe("'scrollback' option", function() line28 | line29 | line30 | - {1: } | + ^ | {3:-- TERMINAL --} | ]]) local term_height = 6 -- Actual terminal screen height, not the scrollback @@ -623,7 +625,7 @@ describe('pending scrollback line handling', function() local bufnr = vim.api.nvim_create_buf(false, true) local args = ... vim.api.nvim_buf_call(bufnr, function() - vim.fn.termopen(args) + vim.fn.jobstart(args, { term = true }) end) vim.api.nvim_win_set_buf(0, bufnr) vim.cmd('startinsert') @@ -634,7 +636,7 @@ describe('pending scrollback line handling', function() screen:expect [[ hi |*4 | - [Process exited 0]{2: } | + [Process exited 0]^ | {3:-- TERMINAL --} | ]] assert_alive() diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index ded0cd99d3..a2dc3c500f 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -26,7 +26,6 @@ local api = n.api local is_ci = t.is_ci local is_os = t.is_os local new_pipename = n.new_pipename -local spawn_argv = n.spawn_argv local set_session = n.set_session local write_file = t.write_file local eval = n.eval @@ -59,7 +58,7 @@ describe('TUI', function() 'colorscheme vim', }) screen:expect([[ - {1: } | + ^ | {4:~ }|*3 {5:[No Name] }| | @@ -105,7 +104,7 @@ describe('TUI', function() -- Need buffer rows to provoke the behavior. feed_data(':edit test/functional/fixtures/bigfile.txt\n') screen:expect([[ - {1:0}000;<control>;Cc;0;BN;;;;;N;NULL;;;; | + ^0000;<control>;Cc;0;BN;;;;;N;NULL;;;; | 0001;<control>;Cc;0;BN;;;;;N;START OF HEADING;;;; | 0002;<control>;Cc;0;BN;;;;;N;START OF TEXT;;;; | 0003;<control>;Cc;0;BN;;;;;N;END OF TEXT;;;; | @@ -155,7 +154,7 @@ describe('TUI', function() {8:FAIL 0} | {8:FAIL 1} | {8:FAIL 2} | - {10:-- More --}{1: } | + {10:-- More --}^ | {3:-- TERMINAL --} | ]], } @@ -170,7 +169,7 @@ describe('TUI', function() {8:FAIL 1} | {8:FAIL 2} | |*2 - {10:-- More --}{1: } | + {10:-- More --}^ | {3:-- TERMINAL --} | ]], } @@ -186,7 +185,7 @@ describe('TUI', function() {8:FAIL 3} | {8:FAIL 4} | {8:FAIL 5} | - {10:-- More --}{1: } | + {10:-- More --}^ | {3:-- TERMINAL --} | ]], } @@ -199,7 +198,7 @@ describe('TUI', function() {8:FAIL 3} | {8:FAIL 4} | {8:FAIL 5} | - {10:-- More --}{1: } | + {10:-- More --}^ | {3:-- TERMINAL --} | ]], } @@ -210,7 +209,7 @@ describe('TUI', function() {8:FAIL 3} | {8:FAIL 4} | {8:FAIL 5} | - {10:-- More --}{1: } | + {10:-- More --}^ | {3:-- TERMINAL --} | ]], } @@ -221,7 +220,7 @@ describe('TUI', function() :call ManyErr() | {8:Error detected while processing function ManyErr:} | {11:line 2:} | - {10:-- More --}{1: } | + {10:-- More --}^ | {3:-- TERMINAL --} | ]], } @@ -237,7 +236,7 @@ describe('TUI', function() {8:FAIL 2} | {8:FAIL 3} | {8:FAIL 4} | - {10:-- More --}{1: } | + {10:-- More --}^ | {3:-- TERMINAL --} | ]], } @@ -245,7 +244,7 @@ describe('TUI', function() feed_data('\003') screen:expect { grid = [[ - {1: } | + ^ | {4:~ }|*6 {5:[No Name] }| | @@ -259,7 +258,7 @@ describe('TUI', function() screen:expect([[ abc | test1 | - test2{1: } | + test2^ | {4:~ }| {5:[No Name] [+] }| {3:-- INSERT --} | @@ -269,7 +268,7 @@ describe('TUI', function() screen:expect([[ abc | test1 | - test{1:2} | + test^2 | {4:~ }| {5:[No Name] [+] }| | @@ -287,14 +286,14 @@ describe('TUI', function() alt-j | alt-k | alt-l | - {1: } | + ^ | {5:[No Name] [+] }| | {3:-- TERMINAL --} | ]]) feed_data('gg') screen:expect([[ - {1:a}lt-d | + ^alt-d | alt-f | alt-g | alt-h | @@ -309,7 +308,7 @@ describe('TUI', function() -- ALT+j inserts "ê". Nvim does not (#3982). feed_data('i\022\027j') screen:expect([[ - <M-j>{1: } | + <M-j>^ | {4:~ }|*3 {5:[No Name] [+] }| {3:-- INSERT --} | @@ -329,7 +328,7 @@ describe('TUI', function() ) feed_data('\027[27u;') screen:expect([[ - ESCsemicolo{1:n} | + ESCsemicolo^n | {4:~ }|*3 {5:[No Name] [+] }| | @@ -343,7 +342,7 @@ describe('TUI', function() it('interprets <Esc><Nul> as <M-C-Space> #17198', function() feed_data('i\022\027\000') screen:expect([[ - <M-C-Space>{1: } | + <M-C-Space>^ | {4:~ }|*3 {5:[No Name] [+] }| {3:-- INSERT --} | @@ -357,7 +356,7 @@ describe('TUI', function() feed_data('\022\022') -- ctrl+v feed_data('\022\013') -- ctrl+m screen:expect([[ - {6:^G^V^M}{1: } | + {6:^G^V^M}^ | {4:~ }|*3 {5:[No Name] [+] }| {3:-- INSERT --} | @@ -376,7 +375,7 @@ describe('TUI', function() {} ) screen:expect([[ - {11: 1 }{1:0}----1----2----3----4│{11: 1 }0----1----2----3----| + {11: 1 }^0----1----2----3----4│{11: 1 }0----1----2----3----| {11: 2 }0----1----2----3----4│{11: 2 }0----1----2----3----| {11: 3 }0----1----2----3----4│{11: 3 }0----1----2----3----| {11: 4 }0----1----2----3----4│{11: 4 }0----1----2----3----| @@ -391,7 +390,7 @@ describe('TUI', function() api.nvim_input_mouse('wheel', 'down', '', 0, 0, 7) end screen:expect([[ - {11: 2 }{1:0}----1----2----3----4│{11: 1 }0----1----2----3----| + {11: 2 }^0----1----2----3----4│{11: 1 }0----1----2----3----| {11: 3 }0----1----2----3----4│{11: 2 }0----1----2----3----| {11: 4 }0----1----2----3----4│{11: 3 }0----1----2----3----| {11: 5 }0----1----2----3----4│{11: 4 }0----1----2----3----| @@ -406,7 +405,7 @@ describe('TUI', function() api.nvim_input_mouse('wheel', 'down', '', 0, 0, 47) end screen:expect([[ - {11: 2 }{1:0}----1----2----3----4│{11: 2 }0----1----2----3----| + {11: 2 }^0----1----2----3----4│{11: 2 }0----1----2----3----| {11: 3 }0----1----2----3----4│{11: 3 }0----1----2----3----| {11: 4 }0----1----2----3----4│{11: 4 }0----1----2----3----| {11: 5 }0----1----2----3----4│{11: 5 }0----1----2----3----| @@ -421,7 +420,7 @@ describe('TUI', function() api.nvim_input_mouse('wheel', 'right', '', 0, 0, 7) end screen:expect([[ - {11: 2 }{1:-}---1----2----3----4-│{11: 2 }0----1----2----3----| + {11: 2 }^----1----2----3----4-│{11: 2 }0----1----2----3----| {11: 3 }----1----2----3----4-│{11: 3 }0----1----2----3----| {11: 4 }----1----2----3----4-│{11: 4 }0----1----2----3----| {11: 5 }----1----2----3----4-│{11: 5 }0----1----2----3----| @@ -436,7 +435,7 @@ describe('TUI', function() api.nvim_input_mouse('wheel', 'right', '', 0, 0, 47) end screen:expect([[ - {11: 2 }{1:-}---1----2----3----4-│{11: 2 }----1----2----3----4| + {11: 2 }^----1----2----3----4-│{11: 2 }----1----2----3----4| {11: 3 }----1----2----3----4-│{11: 3 }----1----2----3----4| {11: 4 }----1----2----3----4-│{11: 4 }----1----2----3----4| {11: 5 }----1----2----3----4-│{11: 5 }----1----2----3----4| @@ -451,7 +450,7 @@ describe('TUI', function() api.nvim_input_mouse('wheel', 'down', 'S', 0, 0, 7) end screen:expect([[ - {11: 5 }{1:-}---1----2----3----4-│{11: 2 }----1----2----3----4| + {11: 5 }^----1----2----3----4-│{11: 2 }----1----2----3----4| {11: 6 }----1----2----3----4-│{11: 3 }----1----2----3----4| {11: 7 }----1----2----3----4-│{11: 4 }----1----2----3----4| {11: 8 }----1----2----3----4-│{11: 5 }----1----2----3----4| @@ -466,7 +465,7 @@ describe('TUI', function() api.nvim_input_mouse('wheel', 'down', 'S', 0, 0, 47) end screen:expect([[ - {11: 5 }{1:-}---1----2----3----4-│{11: 5 }----1----2----3----4| + {11: 5 }^----1----2----3----4-│{11: 5 }----1----2----3----4| {11: 6 }----1----2----3----4-│{11: 6 }----1----2----3----4| {11: 7 }----1----2----3----4-│{11: 7 }----1----2----3----4| {11: 8 }----1----2----3----4-│{11: 8 }----1----2----3----4| @@ -481,7 +480,7 @@ describe('TUI', function() api.nvim_input_mouse('wheel', 'right', 'S', 0, 0, 7) end screen:expect([[ - {11: 5 }{1:-}---6----7----8----9 │{11: 5 }----1----2----3----4| + {11: 5 }^----6----7----8----9 │{11: 5 }----1----2----3----4| {11: 6 }----6----7----8----9 │{11: 6 }----1----2----3----4| {11: 7 }----6----7----8----9 │{11: 7 }----1----2----3----4| {11: 8 }----6----7----8----9 │{11: 8 }----1----2----3----4| @@ -496,7 +495,7 @@ describe('TUI', function() api.nvim_input_mouse('wheel', 'right', 'S', 0, 0, 47) end screen:expect([[ - {11: 5 }{1:-}---6----7----8----9 │{11: 5 }5----6----7----8----| + {11: 5 }^----6----7----8----9 │{11: 5 }5----6----7----8----| {11: 6 }----6----7----8----9 │{11: 6 }5----6----7----8----| {11: 7 }----6----7----8----9 │{11: 7 }5----6----7----8----| {11: 8 }----6----7----8----9 │{11: 8 }5----6----7----8----| @@ -512,7 +511,7 @@ describe('TUI', function() end screen:expect([[ {11: 4 }----6----7----8----9 │{11: 5 }5----6----7----8----| - {11: 5 }{1:-}---6----7----8----9 │{11: 6 }5----6----7----8----| + {11: 5 }^----6----7----8----9 │{11: 6 }5----6----7----8----| {11: 6 }----6----7----8----9 │{11: 7 }5----6----7----8----| {11: 7 }----6----7----8----9 │{11: 8 }5----6----7----8----| {5:[No Name] [+] }{1:[No Name] [+] }| @@ -527,7 +526,7 @@ describe('TUI', function() end screen:expect([[ {11: 4 }----6----7----8----9 │{11: 4 }5----6----7----8----| - {11: 5 }{1:-}---6----7----8----9 │{11: 5 }5----6----7----8----| + {11: 5 }^----6----7----8----9 │{11: 5 }5----6----7----8----| {11: 6 }----6----7----8----9 │{11: 6 }5----6----7----8----| {11: 7 }----6----7----8----9 │{11: 7 }5----6----7----8----| {5:[No Name] [+] }{1:[No Name] [+] }| @@ -542,7 +541,7 @@ describe('TUI', function() end screen:expect([[ {11: 4 }5----6----7----8----9│{11: 4 }5----6----7----8----| - {11: 5 }5{1:-}---6----7----8----9│{11: 5 }5----6----7----8----| + {11: 5 }5^----6----7----8----9│{11: 5 }5----6----7----8----| {11: 6 }5----6----7----8----9│{11: 6 }5----6----7----8----| {11: 7 }5----6----7----8----9│{11: 7 }5----6----7----8----| {5:[No Name] [+] }{1:[No Name] [+] }| @@ -557,7 +556,7 @@ describe('TUI', function() end screen:expect([[ {11: 4 }5----6----7----8----9│{11: 4 }-5----6----7----8---| - {11: 5 }5{1:-}---6----7----8----9│{11: 5 }-5----6----7----8---| + {11: 5 }5^----6----7----8----9│{11: 5 }-5----6----7----8---| {11: 6 }5----6----7----8----9│{11: 6 }-5----6----7----8---| {11: 7 }5----6----7----8----9│{11: 7 }-5----6----7----8---| {5:[No Name] [+] }{1:[No Name] [+] }| @@ -574,7 +573,7 @@ describe('TUI', function() {11: 1 }5----6----7----8----9│{11: 4 }-5----6----7----8---| {11: 2 }5----6----7----8----9│{11: 5 }-5----6----7----8---| {11: 3 }5----6----7----8----9│{11: 6 }-5----6----7----8---| - {11: 4 }5{1:-}---6----7----8----9│{11: 7 }-5----6----7----8---| + {11: 4 }5^----6----7----8----9│{11: 7 }-5----6----7----8---| {5:[No Name] [+] }{1:[No Name] [+] }| | {3:-- TERMINAL --} | @@ -589,7 +588,7 @@ describe('TUI', function() {11: 1 }5----6----7----8----9│{11: 1 }-5----6----7----8---| {11: 2 }5----6----7----8----9│{11: 2 }-5----6----7----8---| {11: 3 }5----6----7----8----9│{11: 3 }-5----6----7----8---| - {11: 4 }5{1:-}---6----7----8----9│{11: 4 }-5----6----7----8---| + {11: 4 }5^----6----7----8----9│{11: 4 }-5----6----7----8---| {5:[No Name] [+] }{1:[No Name] [+] }| | {3:-- TERMINAL --} | @@ -604,7 +603,7 @@ describe('TUI', function() {11: 1 }0----1----2----3----4│{11: 1 }-5----6----7----8---| {11: 2 }0----1----2----3----4│{11: 2 }-5----6----7----8---| {11: 3 }0----1----2----3----4│{11: 3 }-5----6----7----8---| - {11: 4 }0----1----2----3----{1:4}│{11: 4 }-5----6----7----8---| + {11: 4 }0----1----2----3----^4│{11: 4 }-5----6----7----8---| {5:[No Name] [+] }{1:[No Name] [+] }| | {3:-- TERMINAL --} | @@ -619,7 +618,7 @@ describe('TUI', function() {11: 1 }0----1----2----3----4│{11: 1 }0----1----2----3----| {11: 2 }0----1----2----3----4│{11: 2 }0----1----2----3----| {11: 3 }0----1----2----3----4│{11: 3 }0----1----2----3----| - {11: 4 }0----1----2----3----{1:4}│{11: 4 }0----1----2----3----| + {11: 4 }0----1----2----3----^4│{11: 4 }0----1----2----3----| {5:[No Name] [+] }{1:[No Name] [+] }| | {3:-- TERMINAL --} | @@ -645,7 +644,7 @@ describe('TUI', function() aunmenu PopUp " Delete the default MenuPopup event handler. - autocmd! nvim_popupmenu + autocmd! nvim.popupmenu menu PopUp.foo :let g:menustr = 'foo'<CR> menu PopUp.bar :let g:menustr = 'bar'<CR> menu PopUp.baz :let g:menustr = 'baz'<CR> @@ -660,7 +659,7 @@ describe('TUI', function() api.nvim_input_mouse('right', 'press', '', 0, 0, 4) end screen:expect([[ - {1:p}opup menu test | + ^popup menu test | {4:~ }{13: foo }{4: }| {4:~ }{13: bar }{4: }| {4:~ }{13: baz }{4: }| @@ -680,7 +679,7 @@ describe('TUI', function() api.nvim_input_mouse('wheel', 'up', '', 0, 0, 4) end screen:expect([[ - {1:p}opup menu test | + ^popup menu test | {4:~ }{14: foo }{4: }| {4:~ }{13: bar }{4: }| {4:~ }{13: baz }{4: }| @@ -694,7 +693,7 @@ describe('TUI', function() api.nvim_input_mouse('move', '', '', 0, 3, 6) end screen:expect([[ - {1:p}opup menu test | + ^popup menu test | {4:~ }{13: foo }{4: }| {4:~ }{13: bar }{4: }| {4:~ }{14: baz }{4: }| @@ -708,7 +707,7 @@ describe('TUI', function() api.nvim_input_mouse('wheel', 'down', '', 0, 3, 6) end screen:expect([[ - {1:p}opup menu test | + ^popup menu test | {4:~ }{13: foo }{4: }| {4:~ }{14: bar }{4: }| {4:~ }{13: baz }{4: }| @@ -722,7 +721,7 @@ describe('TUI', function() api.nvim_input_mouse('left', 'press', '', 0, 2, 6) end screen:expect([[ - {1:p}opup menu test | + ^popup menu test | {4:~ }|*3 {5:[No Name] [+] }| :let g:menustr = 'bar' | @@ -740,7 +739,7 @@ describe('TUI', function() api.nvim_input_mouse('right', 'press', '', 0, 2, 44) end screen:expect([[ - {1:p}opup menu test | + ^popup menu test | {4:~ }|*2 {4:~ }{13: foo }{4: }| {5:[No Name] [+] }{13: bar }{5: }| @@ -753,7 +752,7 @@ describe('TUI', function() api.nvim_input_mouse('right', 'drag', '', 0, 5, 47) end screen:expect([[ - {1:p}opup menu test | + ^popup menu test | {4:~ }|*2 {4:~ }{13: foo }{4: }| {5:[No Name] [+] }{13: bar }{5: }| @@ -766,7 +765,7 @@ describe('TUI', function() api.nvim_input_mouse('right', 'release', '', 0, 5, 47) end screen:expect([[ - {1:p}opup menu test | + ^popup menu test | {4:~ }|*3 {5:[No Name] [+] }| :let g:menustr = 'baz' | @@ -805,7 +804,7 @@ describe('TUI', function() feed_data(fn.nr2char(57415)) -- KP_EQUAL screen:expect([[ 0123456789./*-+ | - ={1: } | + =^ | {4:~ }|*2 {5:[No Name] [+] }| {3:-- INSERT --} | @@ -814,7 +813,7 @@ describe('TUI', function() feed_data(fn.nr2char(57417)) -- KP_LEFT screen:expect([[ 0123456789./*-+ | - {1:=} | + ^= | {4:~ }|*2 {5:[No Name] [+] }| {3:-- INSERT --} | @@ -823,7 +822,7 @@ describe('TUI', function() feed_data(fn.nr2char(57418)) -- KP_RIGHT screen:expect([[ 0123456789./*-+ | - ={1: } | + =^ | {4:~ }|*2 {5:[No Name] [+] }| {3:-- INSERT --} | @@ -831,7 +830,7 @@ describe('TUI', function() ]]) feed_data(fn.nr2char(57419)) -- KP_UP screen:expect([[ - 0{1:1}23456789./*-+ | + 0^123456789./*-+ | = | {4:~ }|*2 {5:[No Name] [+] }| @@ -841,7 +840,7 @@ describe('TUI', function() feed_data(fn.nr2char(57420)) -- KP_DOWN screen:expect([[ 0123456789./*-+ | - ={1: } | + =^ | {4:~ }|*2 {5:[No Name] [+] }| {3:-- INSERT --} | @@ -850,7 +849,7 @@ describe('TUI', function() feed_data(fn.nr2char(57425)) -- KP_INSERT screen:expect([[ 0123456789./*-+ | - ={1: } | + =^ | {4:~ }|*2 {5:[No Name] [+] }| {3:-- REPLACE --} | @@ -859,7 +858,7 @@ describe('TUI', function() feed_data('\027[27u') -- ESC screen:expect([[ 0123456789./*-+ | - {1:=} | + ^= | {4:~ }|*2 {5:[No Name] [+] }| | @@ -867,7 +866,7 @@ describe('TUI', function() ]]) feed_data('\027[57417;5u') -- CTRL + KP_LEFT screen:expect([[ - {1:0}123456789./*-+ | + ^0123456789./*-+ | = | {4:~ }|*2 {5:[No Name] [+] }| @@ -876,7 +875,7 @@ describe('TUI', function() ]]) feed_data('\027[57418;2u') -- SHIFT + KP_RIGHT screen:expect([[ - 0123456789{1:.}/*-+ | + 0123456789^./*-+ | = | {4:~ }|*2 {5:[No Name] [+] }| @@ -885,7 +884,7 @@ describe('TUI', function() ]]) feed_data(fn.nr2char(57426)) -- KP_DELETE screen:expect([[ - 0123456789{1:/}*-+ | + 0123456789^/*-+ | = | {4:~ }|*2 {5:[No Name] [+] }| @@ -894,7 +893,7 @@ describe('TUI', function() ]]) feed_data(fn.nr2char(57423)) -- KP_HOME screen:expect([[ - {1:0}123456789/*-+ | + ^0123456789/*-+ | = | {4:~ }|*2 {5:[No Name] [+] }| @@ -903,7 +902,7 @@ describe('TUI', function() ]]) feed_data(fn.nr2char(57424)) -- KP_END screen:expect([[ - 0123456789/*-{1:+} | + 0123456789/*-^+ | = | {4:~ }|*2 {5:[No Name] [+] }| @@ -921,7 +920,7 @@ describe('TUI', function() ) screen:expect([[ {12: + [No Name] + [No Name] }{3: [No Name] }{1: }{12:X}| - {1: } | + ^ | {4:~ }|*2 {5:[No Name] }| | @@ -930,7 +929,7 @@ describe('TUI', function() feed_data('\027[57421;5u') -- CTRL + KP_PAGE_UP screen:expect([[ {12: + [No Name] }{3: + [No Name] }{12: [No Name] }{1: }{12:X}| - 0123456789/*-{1:+} | + 0123456789/*-^+ | = | {4:~ }| {5:[No Name] [+] }| @@ -940,7 +939,7 @@ describe('TUI', function() feed_data('\027[57422;5u') -- CTRL + KP_PAGE_DOWN screen:expect([[ {12: + [No Name] + [No Name] }{3: [No Name] }{1: }{12:X}| - {1: } | + ^ | {4:~ }|*2 {5:[No Name] }| | @@ -961,7 +960,7 @@ describe('TUI', function() feed_data('\022\027[57379;48u') -- Shift + Alt + Ctrl + Super + Meta + F16 screen:expect([[ <D-j><T-k><T-D-CR><M-T-C-S-D-BS> | - <D-F13><T-F14><T-D-F15><M-T-C-S-D-F16>{1: } | + <D-F13><T-F14><T-D-F15><M-T-C-S-D-F16>^ | {4:~ }|*2 {5:[No Name] [+] }| {3:-- INSERT --} | @@ -973,7 +972,7 @@ describe('TUI', function() -- "bracketed paste" feed_data('i""\027i\027[200~') screen:expect([[ - "{1:"} | + "^" | {4:~ }|*3 {5:[No Name] [+] }| {3:-- INSERT --} | @@ -982,7 +981,7 @@ describe('TUI', function() feed_data('pasted from terminal') expect_child_buf_lines({ '"pasted from terminal"' }) screen:expect([[ - "pasted from terminal{1:"} | + "pasted from terminal^" | {4:~ }|*3 {5:[No Name] [+] }| {3:-- INSERT --} | @@ -994,7 +993,7 @@ describe('TUI', function() feed_data('\027[27u') -- ESC: go to Normal mode. wait_for_mode('n') screen:expect([[ - "pasted from termina{1:l}" | + "pasted from termina^l" | {4:~ }|*3 {5:[No Name] [+] }| | @@ -1005,7 +1004,7 @@ describe('TUI', function() expect_child_buf_lines({ '"pasted from terminapasted from terminalpasted from terminall"' }) screen:expect([[ "pasted from terminapasted from terminalpasted fro| - m termina{1:l}l" | + m termina^ll" | {4:~ }|*2 {5:[No Name] [+] }| | @@ -1027,7 +1026,7 @@ describe('TUI', function() this is line 1 | this is line 2 | line 3 is here | - {1: } | + ^ | {5:[No Name] [+] }| | {3:-- TERMINAL --} | @@ -1037,7 +1036,7 @@ describe('TUI', function() screen:expect([[ this{16: is line 1} | {16:this is line 2} | - {16:line}{1: }3 is here | + {16:line}^ 3 is here | | {5:[No Name] [+] }| {3:-- SELECT --} | @@ -1047,7 +1046,7 @@ describe('TUI', function() feed_data('just paste it™') feed_data('\027[201~') screen:expect([[ - thisjust paste it{1:™}3 is here | + thisjust paste it^™3 is here | | {4:~ }|*2 {5:[No Name] [+] }| @@ -1084,7 +1083,7 @@ describe('TUI', function() feed_data('i') screen:expect([[ tty ready | - {1: } | + ^ | |*2 {19:^^^^^^^ }| {3:-- TERMINAL --} |*2 @@ -1094,7 +1093,7 @@ describe('TUI', function() feed_data('\027[201~') screen:expect([[ tty ready | - hallo{1: } | + hallo^ | |*2 {19:^^^^^^^ }| {3:-- TERMINAL --} |*2 @@ -1111,7 +1110,7 @@ describe('TUI', function() local expected_grid1 = [[ line 1 | ESC:{6:^[} / CR: | - {1:x} | + ^x | {4:~ }| {5:[No Name] [+] 3,1 All}| | @@ -1126,7 +1125,7 @@ describe('TUI', function() ESC:{6:^[} / CR: | xline 1 | ESC:{6:^[} / CR: | - {1:x} | + ^x | {5:[No Name] [+] 5,1 Bot}| | {3:-- TERMINAL --} | @@ -1165,7 +1164,7 @@ describe('TUI', function() | {4:~ }|*2 {5:[No Name] [+] }| - :"{1:"} | + :"^" | {3:-- TERMINAL --} | ]]) -- "bracketed paste" @@ -1179,7 +1178,7 @@ describe('TUI', function() | {4:~ }|*2 {5:[No Name] [+] }| - :"line 1{1:"} | + :"line 1^" | {3:-- TERMINAL --} | ]]) -- Dot-repeat/redo. @@ -1188,7 +1187,7 @@ describe('TUI', function() feed_data('.') screen:expect([[ foo |*2 - {1: } | + ^ | {4:~ }| {5:[No Name] [+] }| | @@ -1235,7 +1234,7 @@ describe('TUI', function() wait_for_mode('n') screen:expect([[ foo | - {1: } | + ^ | {4:~ }|*2 {5:[No Name] [+] }| | @@ -1249,7 +1248,7 @@ describe('TUI', function() {5: }| {8:paste: Error executing lua: [string "<nvim>"]:4: f}| {8:ake fail} | - {10:Press ENTER or type command to continue}{1: } | + {10:Press ENTER or type command to continue}^ | {3:-- TERMINAL --} | ]]) -- Remaining chunks are discarded after vim.paste() failure. @@ -1265,7 +1264,7 @@ describe('TUI', function() feed_data('.') screen:expect([[ foo |*2 - {1: } | + ^ | {4:~ }| {5:[No Name] [+] }| | @@ -1275,7 +1274,7 @@ describe('TUI', function() feed_data('ityped input...\027[27u') screen:expect([[ foo |*2 - typed input..{1:.} | + typed input..^. | {4:~ }| {5:[No Name] [+] }| | @@ -1288,7 +1287,7 @@ describe('TUI', function() foo | typed input...line A | line B | - {1: } | + ^ | {5:[No Name] [+] }| | {3:-- TERMINAL --} | @@ -1352,7 +1351,7 @@ describe('TUI', function() {5: }| {8:paste: Error executing lua: Vim:E21: Cannot make c}| {8:hanges, 'modifiable' is off} | - {10:Press ENTER or type command to continue}{1: } | + {10:Press ENTER or type command to continue}^ | {3:-- TERMINAL --} | ]]) feed_data('\n') -- <Enter> to dismiss hit-enter prompt @@ -1361,7 +1360,7 @@ describe('TUI', function() screen:expect([[ success 1 | success 2 | - {1: } | + ^ | {4:~ }| {5:[No Name] [+] }| | @@ -1380,7 +1379,7 @@ describe('TUI', function() expected = expected .. ' end' screen:expect([[ zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz| - zzzzzzzzzzzzzz end{1: } | + zzzzzzzzzzzzzz end^ | {4:~ }|*2 {5:[No Name] [+] }| {3:-- INSERT --} | @@ -1399,7 +1398,7 @@ describe('TUI', function() | {4:~ }|*3 {5:[No Name] }| - :<{1: } | + :<^ | {3:-- TERMINAL --} | ]]) end) @@ -1420,7 +1419,7 @@ describe('TUI', function() item 2997 | item 2998 | item 2999 | - item 3000 end{1: } | + item 3000 end^ | {5:[No Name] [+] 3000,14 Bot}| {3:-- INSERT --} | {3:-- TERMINAL --} | @@ -1433,7 +1432,7 @@ describe('TUI', function() item 2997 | item 2998 | item 2999 | - item 3000 en{1:d}d | + item 3000 en^dd | {5:[No Name] [+] 5999,13 Bot}| | {3:-- TERMINAL --} | @@ -1457,7 +1456,7 @@ describe('TUI', function() | pasted from terminal (1) | {6:^[}[200~ | - {1: } | + ^ | {5:[No Name] [+] }| {3:-- INSERT --} | {3:-- TERMINAL --} | @@ -1472,7 +1471,7 @@ describe('TUI', function() -- Send "stop paste" sequence. feed_data('\027[201~') screen:expect([[ - {1: } | + ^ | {4:~ }|*3 {5:[No Name] }| {3:-- INSERT --} | @@ -1487,7 +1486,7 @@ describe('TUI', function() feed_data('\027[2') feed_data('00~pasted from terminal\027[201~') screen:expect([[ - pasted from terminal{1: } | + pasted from terminal^ | {4:~ }|*3 {5:[No Name] [+] }| {3:-- INSERT --} | @@ -1502,7 +1501,7 @@ describe('TUI', function() feed_data('\027[200~pasted from terminal\027[20') feed_data('1~') screen:expect([[ - pasted from terminal{1: } | + pasted from terminal^ | {4:~ }|*3 {5:[No Name] [+] }| {3:-- INSERT --} | @@ -1524,7 +1523,7 @@ describe('TUI', function() wait_for_mode('i') feed_data('\027[200~pasted') -- phase 1 screen:expect([[ - pasted{1: } | + pasted^ | {4:~ }|*3 {5:[No Name] [+] }| {3:-- INSERT --} | @@ -1532,7 +1531,7 @@ describe('TUI', function() ]]) feed_data(' from terminal') -- phase 2 screen:expect([[ - pasted from terminal{1: } | + pasted from terminal^ | {4:~ }|*3 {5:[No Name] [+] }| {3:-- INSERT --} | @@ -1568,7 +1567,7 @@ describe('TUI', function() feed_data('\028\014') -- crtl+\ ctrl+N feed_data(':set termguicolors?\n') screen:expect([[ - {5:^}{6:G} | + {6:^^G} | {2:~ }|*3 {3:[No Name] [+] }| notermguicolors | @@ -1577,7 +1576,7 @@ describe('TUI', function() feed_data(':set termguicolors\n') screen:expect([[ - {7:^}{8:G} | + {8:^^G} | {9:~}{10: }|*3 {3:[No Name] [+] }| :set termguicolors | @@ -1586,7 +1585,7 @@ describe('TUI', function() feed_data(':set notermguicolors\n') screen:expect([[ - {5:^}{6:G} | + {6:^^G} | {2:~ }|*3 {3:[No Name] [+] }| :set notermguicolors | @@ -1634,7 +1633,7 @@ describe('TUI', function() child_exec_lua('vim.cmd.terminal(...)', testprg('tty-test')) screen:expect { grid = [[ - {1:t}ty ready | + ^tty ready | |*3 {2:^^^^^^^ }| | @@ -1646,7 +1645,7 @@ describe('TUI', function() ) screen:expect { grid = [[ - {1:t}ty ready | + ^tty ready | {4:text}{5:color}text | |*2 {2:^^^^^^^ }| @@ -1658,7 +1657,7 @@ describe('TUI', function() feed_data(':set notermguicolors\n') screen:expect { grid = [[ - {1:t}ty ready | + ^tty ready | {4:text}colortext | |*2 {6:^^^^^^^}{7: }| @@ -1681,7 +1680,7 @@ describe('TUI', function() child_session:request('nvim_set_hl', 0, 'Visual', { undercurl = true }) feed_data('ifoobar\027V') screen:expect([[ - {5:fooba}{1:r} | + {5:fooba}^r | {4:~ }|*3 {2:[No Name] [+] }| {3:-- VISUAL LINE --} | @@ -1689,7 +1688,7 @@ describe('TUI', function() ]]) child_session:request('nvim_set_hl', 0, 'Visual', { underdouble = true }) screen:expect([[ - {6:fooba}{1:r} | + {6:fooba}^r | {4:~ }|*3 {2:[No Name] [+] }| {3:-- VISUAL LINE --} | @@ -1777,7 +1776,7 @@ describe('TUI', function() child_session:request('nvim_set_option_value', 'listchars', 'eol:$', { win = 0 }) feed_data('gg') local singlewidth_screen = [[ - {13:℃}{12:℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃}| + {12:^℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃}| {12:℃℃℃℃℃℃℃℃℃℃}{15:$}{12: }| ℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃℃| ℃℃℃℃℃℃℃℃℃℃{4:$} | @@ -1788,7 +1787,7 @@ describe('TUI', function() -- When grid assumes "℃" to be double-width but host terminal assumes it to be single-width, -- the second cell of "℃" is a space and the attributes of the "℃" are applied to it. local doublewidth_screen = [[ - {13:℃}{12: ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ }| + {12:^℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ }| {12:℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ }| {12:℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ }{15:$}{12: }| ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ ℃ {4:@@@@}| @@ -1821,7 +1820,7 @@ describe('TUI', function() child_session:request('nvim_set_option_value', 'listchars', 'eol:$', { win = 0 }) feed_data('gg') local singlewidth_screen = [[ - {13:✓}{12:✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓}| + {12:^✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓}| {12:✓✓✓✓✓✓✓✓✓✓}{15:$}{12: }| ✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓| ✓✓✓✓✓✓✓✓✓✓{4:$} | @@ -1832,7 +1831,7 @@ describe('TUI', function() -- When grid assumes "✓" to be double-width but host terminal assumes it to be single-width, -- the second cell of "✓" is a space and the attributes of the "✓" are applied to it. local doublewidth_screen = [[ - {13:✓}{12: ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ }| + {12:^✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ }| {12:✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ }| {12:✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ }{15:$}{12: }| ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ {4:@@@@}| @@ -1870,7 +1869,7 @@ describe('TUI', function() -- Close the :intro message and redraw the lines. feed_data('\n') screen:expect([[ - {13:Ꝩ}{12:ꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨ}| + {12:^ꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨ}| {12:ꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨ}|*310 {12:ꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨ℃ }| b | @@ -1912,7 +1911,7 @@ describe('TUI', function() -- Close the :intro message and redraw the lines. feed_data('\n') screen:expect([[ - {1:Ꝩ}ꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨ| + ^ꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨ| ꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨ|*325 {3:-- TERMINAL --} | ]]) @@ -1925,7 +1924,7 @@ describe('TUI', function() feed_data ':set visualbell\n' screen:expect { grid = [[ - {1: } | + ^ | {4:~ }|*3 {5:[No Name] }| :set visualbell | @@ -1939,7 +1938,7 @@ describe('TUI', function() feed_data 'i' screen:expect { grid = [[ - {1: } | + ^ | {4:~ }|*3 {5:[No Name] }| {3:-- INSERT --} | @@ -1954,7 +1953,7 @@ describe('TUI', function() grid = [[ Vim: Caught deadly signal 'SIGTERM' | |*2 - [Process exited 1]{1: } | + [Process exited 1]^ | |*2 {3:-- TERMINAL --} | ]], @@ -1981,7 +1980,7 @@ describe('TUI', function() [5] = { bold = true }, }) screen:expect([[ - {1: } | + ^ | {2:~}{3: }|*3 {4:[No Name] }| | @@ -1989,7 +1988,7 @@ describe('TUI', function() ]]) feed_data('i') screen:expect([[ - {1: } | + ^ | {2:~}{3: }|*3 {4:[No Name] }| {5:-- INSERT --} | @@ -2000,7 +1999,7 @@ describe('TUI', function() it('redraws on SIGWINCH even if terminal size is unchanged #23411', function() child_session:request('nvim_echo', { { 'foo' } }, false, {}) screen:expect([[ - {1: } | + ^ | {4:~ }|*3 {5:[No Name] }| foo | @@ -2008,7 +2007,7 @@ describe('TUI', function() ]]) exec_lua([[vim.uv.kill(vim.fn.jobpid(vim.bo.channel), 'sigwinch')]]) screen:expect([[ - {1: } | + ^ | {4:~ }|*3 {5:[No Name] }| | @@ -2031,7 +2030,7 @@ describe('TUI', function() ]]) feed_data('\003') screen:expect([[ - {1: } | + ^ | {4:~ }|*3 {5:[No Name] }| Type :qa and press <Enter> to exit Nvim | @@ -2046,7 +2045,7 @@ describe('TUI', function() {1:foo} | {4:~ }|*3 {5:[No Name] [+] }| - /foo{1: } | + /foo^ | {3:-- TERMINAL --} | ]]) screen:sleep(10) @@ -2055,7 +2054,7 @@ describe('TUI', function() foo | {4:~ }|*3 {5:[No Name] [+] }| - /foob{1: } | + /foob^ | {3:-- TERMINAL --} | ]]) screen:sleep(10) @@ -2064,7 +2063,7 @@ describe('TUI', function() foo | {4:~ }|*3 {5:[No Name] [+] }| - /fooba{1: } | + /fooba^ | {3:-- TERMINAL --} | ]]) end) @@ -2114,7 +2113,7 @@ describe('TUI', function() [5] = { bold = true, reverse = true }, [6] = { foreground = Screen.colors.White, background = Screen.colors.DarkGreen }, }) - fn.termopen({ + fn.jobstart({ nvim_prog, '--clean', '--cmd', @@ -2124,6 +2123,7 @@ describe('TUI', function() '--cmd', 'let start = reltime() | while v:true | if reltimefloat(reltime(start)) > 2 | break | endif | endwhile', }, { + term = true, env = { VIMRUNTIME = os.getenv('VIMRUNTIME'), }, @@ -2146,7 +2146,7 @@ describe('TUI', function() for _, guicolors in ipairs({ 'notermguicolors', 'termguicolors' }) do it('has no black flicker when clearing regions during startup with ' .. guicolors, function() local screen = Screen.new(50, 10) - fn.termopen({ + fn.jobstart({ nvim_prog, '--clean', '--cmd', @@ -2154,6 +2154,7 @@ describe('TUI', function() '--cmd', 'sleep 10', }, { + term = true, env = { VIMRUNTIME = os.getenv('VIMRUNTIME'), }, @@ -2194,7 +2195,7 @@ describe('TUI', function() local screen = tt.setup_child_nvim({ '--clean', '-l', script_file }) screen:expect { grid = [[ - {1: } | + ^ | ~ |*3 [No Name] 0,0-1 All| | @@ -2207,7 +2208,7 @@ describe('TUI', function() Xargv0nvim | --embed | --clean | - {1:X}argv0nvim | + ^Xargv0nvim | [No Name] [+] 5,1 Bot| 4 more lines | {3:-- TERMINAL --} | @@ -2233,7 +2234,7 @@ describe('TUI', function() :q | abc | | - [Process exited 0]{1: } | + [Process exited 0]^ | | {3:-- TERMINAL --} | ]]) @@ -2254,7 +2255,7 @@ describe('TUI', function() }) screen:expect { grid = [[ - {1: } | + ^ | {4:~ }|*3 {5:[No Name] }| | @@ -2264,7 +2265,7 @@ describe('TUI', function() command([[call chansend(b:terminal_job_id, "\<C-h>")]]) screen:expect([[ - {1: } | + ^ | {4:~ }|*3 {5:[No Name] }| <C-h> | @@ -2287,7 +2288,7 @@ describe('TUI', function() }, { cols = 80 }) screen:expect { grid = [[ - {1:1}st line | + ^1st line | |*2 2nd line | {5:[No Name] [+] 1,1 All}| @@ -2300,7 +2301,7 @@ describe('TUI', function() grid = [[ 1st line | | - {1: } | + ^ | 2nd line | {5:[No Name] [+] 1,161 All}| | @@ -2320,7 +2321,7 @@ describe('TUI', function() }, { extra_rows = 10, cols = 66 }) screen:expect { grid = [[ - | + ^ | aabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabb|*12 aabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabba@@@| [No Name] [+] 1,0-1 Top| @@ -2339,7 +2340,7 @@ describe('TUI', function() -- 500-cell limit, so the buffer is flushed after these spaces. screen:expect { grid = [[ - | + ^ | aabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabb|*12 aabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabba@@@| [No Name] [+] 1,0-1 Top| @@ -2366,7 +2367,7 @@ describe('TUI', function() screen:expect { grid = [[ - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + ^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| ~ |*3 [No Name] [+] 1,1 All| | @@ -2378,7 +2379,8 @@ describe('TUI', function() feed_data(':set columns=12\n') screen:expect { grid = [[ - aaaaaaaaaaaa |*4 + ^aaaaaaaaaaaa | + aaaaaaaaaaaa |*3 < [+] 1,1 | | -- TERMINAL -- | @@ -2416,7 +2418,7 @@ describe('TUI UIEnter/UILeave', function() }) screen:expect { grid = [[ - {1: } | + ^ | {4:~ }|*3 {5:[No Name] }| | @@ -2426,7 +2428,7 @@ describe('TUI UIEnter/UILeave', function() feed_data(':echo g:evs\n') screen:expect { grid = [[ - {1: } | + ^ | {4:~ }|*3 {5:[No Name] }| ['VimEnter', 'UIEnter'] | @@ -2457,7 +2459,7 @@ describe('TUI FocusGained/FocusLost', function() }) screen:expect([[ - {1: } | + ^ | {4:~ }|*3 {5:[No Name] }| | @@ -2479,7 +2481,7 @@ describe('TUI FocusGained/FocusLost', function() retry(2, 3 * screen.timeout, function() feed_data('\027[I') screen:expect([[ - {1: } | + ^ | {4:~ }|*3 {5:[No Name] }| gained | @@ -2488,7 +2490,7 @@ describe('TUI FocusGained/FocusLost', function() feed_data('\027[O') screen:expect([[ - {1: } | + ^ | {4:~ }|*3 {5:[No Name] }| lost | @@ -2502,7 +2504,7 @@ describe('TUI FocusGained/FocusLost', function() feed_data('i') screen:expect { grid = [[ - {1: } | + ^ | {4:~ }|*3 {5:[No Name] }| :set noshowmode | @@ -2512,7 +2514,7 @@ describe('TUI FocusGained/FocusLost', function() retry(2, 3 * screen.timeout, function() feed_data('\027[I') screen:expect([[ - {1: } | + ^ | {4:~ }|*3 {5:[No Name] }| gained | @@ -2520,7 +2522,7 @@ describe('TUI FocusGained/FocusLost', function() ]]) feed_data('\027[O') screen:expect([[ - {1: } | + ^ | {4:~ }|*3 {5:[No Name] }| lost | @@ -2538,7 +2540,7 @@ describe('TUI FocusGained/FocusLost', function() | {4:~ }|*3 {5:[No Name] }| - :{1: } | + :^ | {3:-- TERMINAL --} | ]]) feed_data('\027[O') @@ -2547,7 +2549,7 @@ describe('TUI FocusGained/FocusLost', function() | {4:~ }|*3 {5:[No Name] }| - :{1: } | + :^ | {3:-- TERMINAL --} | ]], unchanged = true, @@ -2590,7 +2592,7 @@ describe('TUI FocusGained/FocusLost', function() -- Wait for terminal to be ready. screen:expect { grid = [[ - {1:r}eady $ zia | + ^ready $ zia | | [Process exited 0] | |*2 @@ -2602,7 +2604,7 @@ describe('TUI FocusGained/FocusLost', function() feed_data('\027[I') screen:expect { grid = [[ - {1:r}eady $ zia | + ^ready $ zia | | [Process exited 0] | |*2 @@ -2614,7 +2616,7 @@ describe('TUI FocusGained/FocusLost', function() feed_data('\027[O') screen:expect([[ - {1:r}eady $ zia | + ^ready $ zia | | [Process exited 0] | |*2 @@ -2634,7 +2636,7 @@ describe('TUI FocusGained/FocusLost', function() msg3 | msg4 | msg5 | - {10:Press ENTER or type command to continue}{1: } | + {10:Press ENTER or type command to continue}^ | {3:-- TERMINAL --} | ]], } @@ -2647,7 +2649,7 @@ describe('TUI FocusGained/FocusLost', function() msg3 | msg4 | msg5 | - {10:Press ENTER or type command to continue}{1: } | + {10:Press ENTER or type command to continue}^ | {3:-- TERMINAL --} | ]], unchanged = true, @@ -2690,7 +2692,7 @@ describe("TUI 't_Co' (terminal colors)", function() screen:expect(string.format( [[ - {1: } | + ^ | %s|*4 | {3:-- TERMINAL --} | @@ -2701,7 +2703,7 @@ describe("TUI 't_Co' (terminal colors)", function() feed_data(':echo &t_Co\n') screen:expect(string.format( [[ - {1: } | + ^ | %s|*4 %-3s | {3:-- TERMINAL --} | @@ -3028,7 +3030,7 @@ describe('TUI', function() -- Wait for TUI to start. feed_data('Gitext') screen:expect([[ - text{1: } | + text^ | {4:~ }|*4 {3:-- INSERT --} | {3:-- TERMINAL --} | @@ -3045,7 +3047,7 @@ describe('TUI', function() nvim_tui() screen:expect([[ - {1: } | + ^ | {4:~ }|*4 | {3:-- TERMINAL --} | @@ -3055,7 +3057,7 @@ describe('TUI', function() screen:expect { grid = [[ - {1: } | + ^ | {4:~ }|*4 | {3:-- TERMINAL --} | @@ -3181,7 +3183,6 @@ describe('TUI', function() local req = args.data local payload = req:match('^\027P%+q([%x;]+)$') if payload and vim.text.hexdecode(payload) == 'Ms' then - vim.g.xtgettcap = 'Ms' local resp = string.format('\027P1+r%s=%s\027\\', payload, vim.text.hexencode('\027]52;;\027\\')) vim.api.nvim_chan_send(vim.bo[args.buf].channel, resp) return true @@ -3199,9 +3200,6 @@ describe('TUI', function() }, { env = { VIMRUNTIME = os.getenv('VIMRUNTIME'), - - -- Only queries when SSH_TTY is set - SSH_TTY = '/dev/pts/1', }, }) @@ -3209,8 +3207,7 @@ describe('TUI', function() local child_session = n.connect(child_server) retry(nil, 1000, function() - eq('Ms', eval("get(g:, 'xtgettcap', '')")) - eq({ true, 'OSC 52' }, { child_session:request('nvim_eval', 'g:clipboard.name') }) + eq({ true, { osc52 = true } }, { child_session:request('nvim_eval', 'g:termfeatures') }) end) end) end) @@ -3305,13 +3302,39 @@ describe('TUI bg color', function() 'autocmd OptionSet background echo "did OptionSet, yay!"', }) screen:expect([[ - {1: } | + ^ | {3:~} |*3 {5:[No Name] 0,0-1 All}| did OptionSet, yay! | {3:-- TERMINAL --} | ]]) end) + + it('sends theme update notifications when background changes #31652', function() + command('set background=dark') -- set outer Nvim background + local child_server = new_pipename() + local screen = tt.setup_child_nvim({ + '--listen', + child_server, + '-u', + 'NONE', + '-i', + 'NONE', + '--cmd', + 'colorscheme vim', + '--cmd', + 'set noswapfile', + }) + screen:expect({ any = '%[No Name%]' }) + local child_session = n.connect(child_server) + retry(nil, nil, function() + eq({ true, 'dark' }, { child_session:request('nvim_eval', '&background') }) + end) + command('set background=light') -- set outer Nvim background + retry(nil, nil, function() + eq({ true, 'light' }, { child_session:request('nvim_eval', '&background') }) + end) + end) end) -- These tests require `tt` because --headless/--embed @@ -3322,8 +3345,8 @@ describe('TUI as a client', function() end) it('connects to remote instance (with its own TUI)', function() - local server_super = spawn_argv(false) -- equivalent to clear() - local client_super = spawn_argv(true) + local server_super = n.new_session(false) + local client_super = n.new_session(true) set_session(server_super) local server_pipe = new_pipename() @@ -3343,7 +3366,7 @@ describe('TUI as a client', function() feed_data('iHello, World') screen_server:expect { grid = [[ - Hello, World{1: } | + Hello, World^ | {4:~ }|*3 {5:[No Name] [+] }| {3:-- INSERT --} | @@ -3353,7 +3376,7 @@ describe('TUI as a client', function() feed_data('\027') screen_server:expect { grid = [[ - Hello, Worl{1:d} | + Hello, Worl^d | {4:~ }|*3 {5:[No Name] [+] }| | @@ -3370,7 +3393,7 @@ describe('TUI as a client', function() screen_client:expect { grid = [[ - Hello, Worl{1:d} | + Hello, Worl^d | {4:~ }|*3 {5:[No Name] [+] }| | @@ -3383,7 +3406,7 @@ describe('TUI as a client', function() feed_data('0:set lines=3\n') screen_server:expect { grid = [[ - {1:a}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + ^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| {5:[No Name] [+] }| |*4 {3:-- TERMINAL --} | @@ -3397,8 +3420,8 @@ describe('TUI as a client', function() end) it('connects to remote instance (--headless)', function() - local server = spawn_argv(false) -- equivalent to clear() - local client_super = spawn_argv(true, { env = { NVIM_LOG_FILE = testlog } }) + local server = n.new_session(false) + local client_super = n.new_session(true, { env = { NVIM_LOG_FILE = testlog } }) set_session(server) local server_pipe = api.nvim_get_vvar('servername') @@ -3414,7 +3437,7 @@ describe('TUI as a client', function() screen_client:expect { grid = [[ - Halloj{1:!} | + Halloj^! | {4:~ }|*4 | {3:-- TERMINAL --} | @@ -3428,7 +3451,7 @@ describe('TUI as a client', function() grid = [[ Vim: Caught deadly signal 'SIGTERM' | |*2 - [Process exited 1]{1: } | + [Process exited 1]^ | |*2 {3:-- TERMINAL --} | ]], @@ -3457,15 +3480,15 @@ describe('TUI as a client', function() screen:expect([[ Remote ui failed to start: {MATCH:.*}| | - [Process exited 1]{1: } | + [Process exited 1]^ | |*3 {3:-- TERMINAL --} | ]]) end) local function test_remote_tui_quit(status) - local server_super = spawn_argv(false) -- equivalent to clear() - local client_super = spawn_argv(true) + local server_super = n.new_session(false) + local client_super = n.new_session(true) set_session(server_super) local server_pipe = new_pipename() @@ -3483,7 +3506,7 @@ describe('TUI as a client', function() }) screen_server:expect { grid = [[ - {1: } | + ^ | {4:~ }|*3 {5:[No Name] }| | @@ -3494,7 +3517,7 @@ describe('TUI as a client', function() feed_data('iHello, World') screen_server:expect { grid = [[ - Hello, World{1: } | + Hello, World^ | {4:~ }|*3 {5:[No Name] [+] }| {3:-- INSERT --} | @@ -3504,7 +3527,7 @@ describe('TUI as a client', function() feed_data('\027') screen_server:expect { grid = [[ - Hello, Worl{1:d} | + Hello, Worl^d | {4:~ }|*3 {5:[No Name] [+] }| | @@ -3521,7 +3544,7 @@ describe('TUI as a client', function() screen_client:expect { grid = [[ - Hello, Worl{1:d} | + Hello, Worl^d | {4:~ }|*3 {5:[No Name] [+] }| | @@ -3536,7 +3559,7 @@ describe('TUI as a client', function() screen_server:expect { grid = [[ | - [Process exited ]] .. status .. [[]{1: }{MATCH:%s+}| + [Process exited ]] .. status .. [[]^ {MATCH:%s+}| |*4 {3:-- TERMINAL --} | ]], @@ -3545,7 +3568,7 @@ describe('TUI as a client', function() screen_client:expect { grid = [[ | - [Process exited ]] .. status .. [[]{1: }{MATCH:%s+}| + [Process exited ]] .. status .. [[]^ {MATCH:%s+}| |*4 {3:-- TERMINAL --} | ]], diff --git a/test/functional/terminal/window_spec.lua b/test/functional/terminal/window_spec.lua index fdb606e959..a65d18de70 100644 --- a/test/functional/terminal/window_spec.lua +++ b/test/functional/terminal/window_spec.lua @@ -62,7 +62,7 @@ describe(':terminal window', function() screen:expect([[ {7:1 }tty ready | {7:2 }rows: 6, cols: 48 | - {7:3 }{1: } | + {7:3 }^ | {7:4 } | {7:5 } | {7:6 } | @@ -73,7 +73,7 @@ describe(':terminal window', function() {7:1 }tty ready | {7:2 }rows: 6, cols: 48 | {7:3 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV| - {7:4 }WXYZ{1: } | + {7:4 }WXYZ^ | {7:5 } | {7:6 } | {3:-- TERMINAL --} | @@ -87,7 +87,7 @@ describe(':terminal window', function() {7: 2 }rows: 6, cols: 48 | {7: 3 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNO| {7: 4 }PQRSTUVWXYZrows: 6, cols: 41 | - {7: 5 }{1: } | + {7: 5 }^ | {7: 6 } | {3:-- TERMINAL --} | ]]) @@ -98,7 +98,7 @@ describe(':terminal window', function() {7: 3 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNO| {7: 4 }PQRSTUVWXYZrows: 6, cols: 41 | {7: 5 } abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMN| - {7: 6 }OPQRSTUVWXYZ{1: } | + {7: 6 }OPQRSTUVWXYZ^ | {3:-- TERMINAL --} | ]]) end) @@ -110,7 +110,7 @@ describe(':terminal window', function() screen:expect([[ {7:++1 }tty ready | {7:++2 }rows: 6, cols: 45 | - {7:++3 }{1: } | + {7:++3 }^ | {7:++4 } | {7:++5 } | {7:++6 } | @@ -123,7 +123,7 @@ describe(':terminal window', function() {7:++6 } | {7:++7 } | {7:++8 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRS| - {7:++9 }TUVWXYZ{1: } | + {7:++9 }TUVWXYZ^ | {3:-- TERMINAL --} | ]]) feed_data('\nabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') @@ -133,7 +133,7 @@ describe(':terminal window', function() {7:++ 9 }STUVWXYZ | {7:++10 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQR| {7:++11 }STUVWXYZrows: 6, cols: 44 | - {7:++12 }{1: } | + {7:++12 }^ | {3:-- TERMINAL --} | ]]) end) @@ -144,7 +144,7 @@ describe(':terminal window', function() feed([[<C-\><C-N>]]) screen:expect([[ tty ready | - {2:^ } | + ^ | |*5 ]]) feed(':set colorcolumn=20<CR>i') @@ -153,7 +153,7 @@ describe(':terminal window', function() it('wont show the color column', function() screen:expect([[ tty ready | - {1: } | + ^ | |*4 {3:-- TERMINAL --} | ]]) @@ -170,7 +170,7 @@ describe(':terminal window', function() line2 | line3 | line4 | - {1: } | + ^ | {3:-- TERMINAL --} | ]]) end) @@ -184,7 +184,7 @@ describe(':terminal window', function() line2 | line3 | line4 | - {2: } | + | | ]]) end) @@ -206,7 +206,7 @@ describe(':terminal with multigrid', function() [3:--------------------------------------------------]| ## grid 2 tty ready | - {1: } | + ^ | |*4 ## grid 3 {3:-- TERMINAL --} | @@ -223,7 +223,7 @@ describe(':terminal with multigrid', function() ## grid 2 tty ready | rows: 10, cols: 20 | - {1: } | + ^ | |*7 ## grid 3 {3:-- TERMINAL --} | @@ -241,7 +241,7 @@ describe(':terminal with multigrid', function() ## grid 2 rows: 10, cols: 20 | rows: 3, cols: 70 | - {1: } | + ^ | ## grid 3 {3:-- TERMINAL --} | ]]) @@ -260,7 +260,7 @@ describe(':terminal with multigrid', function() rows: 10, cols: 20 | rows: 3, cols: 70 | rows: 6, cols: 50 | - {1: } | + ^ | | ## grid 3 {3:-- TERMINAL --} | diff --git a/test/functional/terminal/window_split_tab_spec.lua b/test/functional/terminal/window_split_tab_spec.lua index 272fc513af..dc22c87ca0 100644 --- a/test/functional/terminal/window_split_tab_spec.lua +++ b/test/functional/terminal/window_split_tab_spec.lua @@ -49,7 +49,7 @@ describe(':terminal', function() ========== | tty ready | rows: 5, cols: 50 | - {2: } | + | |*2 ========== | :2split | @@ -61,7 +61,7 @@ describe(':terminal', function() ========== | ^tty ready | rows: 5, cols: 50 | - {2: } | + | |*2 ========== | :wincmd p | @@ -77,7 +77,7 @@ describe(':terminal', function() command('bprevious') screen:expect([[ tty ready | - ^foo{2: } | + ^foo | |*8 ]]) end) @@ -102,7 +102,7 @@ describe(':terminal', function() screen:expect([[ tty ready | rows: 7, cols: 47 | - {2: } | + | |*3 ^ | | @@ -112,7 +112,7 @@ describe(':terminal', function() tty ready | rows: 7, cols: 47 | rows: 4, cols: 41 | - {2:^ } | + ^ | | ]]) end) |