mirror of
https://github.com/neovim/neovim.git
synced 2025-09-05 19:08:15 +00:00
test(tui_spec): flakiness, global highlight definitions #34958
This commit is contained in:
@@ -45,52 +45,37 @@ describe('autoread TUI FocusGained/FocusLost', function()
|
||||
local atime = os.time() - 10
|
||||
vim.uv.fs_utime(path, atime, atime)
|
||||
|
||||
screen:expect {
|
||||
grid = [[
|
||||
screen:expect([[
|
||||
^ |
|
||||
{4:~ }|*3
|
||||
{5:[No Name] }|
|
||||
{100:~ }|*3
|
||||
{3:[No Name] }|
|
||||
|
|
||||
{3:-- TERMINAL --} |
|
||||
]],
|
||||
}
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
feed_command('edit ' .. path)
|
||||
screen:expect {
|
||||
grid = [[
|
||||
screen:expect([[
|
||||
^ |
|
||||
{4:~ }|*3
|
||||
{5:xtest-foo }|
|
||||
{100:~ }|*3
|
||||
{3:xtest-foo }|
|
||||
:edit xtest-foo |
|
||||
{3:-- TERMINAL --} |
|
||||
]],
|
||||
}
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
feed_data('\027[O')
|
||||
feed_data('\027[O')
|
||||
screen:expect {
|
||||
grid = [[
|
||||
^ |
|
||||
{4:~ }|*3
|
||||
{5:xtest-foo }|
|
||||
:edit xtest-foo |
|
||||
{3:-- TERMINAL --} |
|
||||
]],
|
||||
unchanged = true,
|
||||
}
|
||||
screen:expect_unchanged()
|
||||
|
||||
t.write_file(path, expected_addition)
|
||||
|
||||
feed_data('\027[I')
|
||||
|
||||
screen:expect {
|
||||
grid = [[
|
||||
screen:expect([[
|
||||
^line 1 |
|
||||
line 2 |
|
||||
line 3 |
|
||||
line 4 |
|
||||
{5:xtest-foo }|
|
||||
{3:xtest-foo }|
|
||||
:edit xtest-foo |
|
||||
{3:-- TERMINAL --} |
|
||||
]],
|
||||
}
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
|
@@ -961,16 +961,14 @@ describe('jobs', function()
|
||||
]],
|
||||
timeout = 100,
|
||||
}
|
||||
screen:expect {
|
||||
grid = [[
|
||||
screen:expect([[
|
||||
|
|
||||
{3: }|
|
||||
aaa |
|
||||
bbb |
|
||||
ccc |
|
||||
{6:Press ENTER or type command to continue}^ |
|
||||
]],
|
||||
}
|
||||
]])
|
||||
feed('<CR>')
|
||||
fn.jobstop(api.nvim_get_var('id'))
|
||||
end)
|
||||
@@ -993,16 +991,14 @@ describe('jobs', function()
|
||||
endfunc
|
||||
]])
|
||||
feed_command('call PrintAndPoll()')
|
||||
screen:expect {
|
||||
grid = [[
|
||||
screen:expect([[
|
||||
|
|
||||
{3: }|
|
||||
aaa |
|
||||
bbb |
|
||||
ccc |
|
||||
{6:Press ENTER or type command to continue}^ |
|
||||
]],
|
||||
}
|
||||
]])
|
||||
feed('<CR>')
|
||||
fn.jobstop(api.nvim_get_var('id'))
|
||||
eq(0, busy)
|
||||
@@ -1260,9 +1256,9 @@ describe('jobs', function()
|
||||
screen:expect([[
|
||||
^ |
|
||||
~ |*3
|
||||
{1:[No Name] 0,0-1 All}|
|
||||
{2:[No Name] 0,0-1 All}|
|
||||
|
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
|
||||
feed(':q<CR>')
|
||||
@@ -1273,7 +1269,7 @@ describe('jobs', function()
|
||||
|
|
||||
[Process exited 0]^ |
|
||||
|*4
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end
|
||||
end)
|
||||
|
@@ -49,7 +49,7 @@ describe('log', function()
|
||||
^ |
|
||||
~ |*4
|
||||
|
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end
|
||||
|
||||
|
@@ -36,13 +36,13 @@ describe(':terminal altscreen', function()
|
||||
line7 |
|
||||
line8 |
|
||||
^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
enter_altscreen()
|
||||
screen:expect([[
|
||||
|*5
|
||||
^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq(10, api.nvim_buf_line_count(0))
|
||||
end)
|
||||
@@ -69,7 +69,7 @@ describe(':terminal altscreen', function()
|
||||
line7 |
|
||||
line8 |
|
||||
^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
feed('<c-\\><c-n>gg')
|
||||
screen:expect([[
|
||||
@@ -104,7 +104,7 @@ describe(':terminal altscreen', function()
|
||||
line15 |
|
||||
line16 |
|
||||
^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end)
|
||||
|
||||
@@ -133,7 +133,7 @@ describe(':terminal altscreen', function()
|
||||
|*2
|
||||
rows: 4, cols: 50 |
|
||||
^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end
|
||||
|
||||
@@ -161,7 +161,7 @@ describe(':terminal altscreen', function()
|
||||
line6 |
|
||||
line7 |
|
||||
^line8 |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
|
@@ -31,14 +31,12 @@ describe('api', function()
|
||||
end)
|
||||
|
||||
it('qa! RPC request during insert-mode', function()
|
||||
screen:expect {
|
||||
grid = [[
|
||||
screen:expect([[
|
||||
^ |
|
||||
{4:~ }|*4
|
||||
{100:~ }|*4
|
||||
|
|
||||
{3:-- TERMINAL --} |
|
||||
]],
|
||||
}
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
|
||||
-- Start the socket from the child nvim.
|
||||
tt.feed_data(":echo serverstart('" .. socket_name .. "')\n")
|
||||
@@ -46,9 +44,9 @@ describe('api', function()
|
||||
-- Wait for socket creation.
|
||||
screen:expect([[
|
||||
^ |
|
||||
{4:~ }|*4
|
||||
{100:~ }|*4
|
||||
]] .. socket_name .. [[ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
|
||||
local socket_session1 = n.connect(socket_name)
|
||||
@@ -58,9 +56,9 @@ describe('api', function()
|
||||
-- Wait for stdin to be processed.
|
||||
screen:expect([[
|
||||
[tui] insert-mode^ |
|
||||
{4:~ }|*4
|
||||
{3:-- INSERT --} |
|
||||
{3:-- TERMINAL --} |
|
||||
{100:~ }|*4
|
||||
{5:-- INSERT --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
|
||||
ok((socket_session1:request('nvim_ui_attach', 42, 6, { rgb = true })))
|
||||
@@ -74,9 +72,9 @@ describe('api', function()
|
||||
[socket 1] this is more t |
|
||||
han 25 columns |
|
||||
[socket 2] input^ |
|
||||
{4:~ } |
|
||||
{3:-- INSERT --} |
|
||||
{3:-- TERMINAL --} |
|
||||
{100:~ } |
|
||||
{5:-- INSERT --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
|
||||
socket_session1:request('nvim_command', 'qa!')
|
||||
|
@@ -69,7 +69,7 @@ describe(':terminal buffer', function()
|
||||
feed('<c-\\><c-n>:set bufhidden=wipe<cr>:enew<cr>')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{4:~ }|*5
|
||||
{100:~ }|*5
|
||||
:enew |
|
||||
]])
|
||||
end)
|
||||
@@ -78,7 +78,7 @@ describe(':terminal buffer', function()
|
||||
feed(':bnext:l<esc>')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{4:~ }|*5
|
||||
{100:~ }|*5
|
||||
|
|
||||
]])
|
||||
end)
|
||||
@@ -111,7 +111,7 @@ describe(':terminal buffer', function()
|
||||
tty ready |
|
||||
^ |
|
||||
|*4
|
||||
{8:E21: Cannot make changes, 'modifiable' is off} |
|
||||
{101:E21: Cannot make changes, 'modifiable' is off} |
|
||||
]])
|
||||
end)
|
||||
|
||||
@@ -162,13 +162,13 @@ describe(':terminal buffer', function()
|
||||
feed('<c-\\><c-n>:bd!<cr>')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{4:~ }|*5
|
||||
{100:~ }|*5
|
||||
:bd! |
|
||||
]])
|
||||
feed_command('bnext')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{4:~ }|*5
|
||||
{100:~ }|*5
|
||||
:bnext |
|
||||
]])
|
||||
end)
|
||||
@@ -195,11 +195,11 @@ describe(':terminal buffer', function()
|
||||
-- We should be in a new buffer now.
|
||||
screen:expect([[
|
||||
ab^c |
|
||||
{4:~ }|
|
||||
{5:========== }|
|
||||
{100:~ }|
|
||||
{3:========== }|
|
||||
rows: 2, cols: 50 |
|
||||
|
|
||||
{18:========== }|
|
||||
{119:========== }|
|
||||
|
|
||||
]])
|
||||
|
||||
@@ -236,7 +236,7 @@ describe(':terminal buffer', function()
|
||||
ydaer ytt|
|
||||
^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
|
||||
|*4
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
command('bdelete!')
|
||||
end)
|
||||
@@ -274,35 +274,29 @@ describe(':terminal buffer', function()
|
||||
it([[can use temporary normal mode <c-\><c-o>]], function()
|
||||
eq('t', fn.mode(1))
|
||||
feed [[<c-\><c-o>]]
|
||||
screen:expect {
|
||||
grid = [[
|
||||
screen:expect([[
|
||||
tty ready |
|
||||
^ |
|
||||
|*4
|
||||
{3:-- (terminal) --} |
|
||||
]],
|
||||
}
|
||||
{5:-- (terminal) --} |
|
||||
]])
|
||||
eq('ntT', fn.mode(1))
|
||||
|
||||
feed [[:let g:x = 17]]
|
||||
screen:expect {
|
||||
grid = [[
|
||||
screen:expect([[
|
||||
tty ready |
|
||||
|
|
||||
|*4
|
||||
:let g:x = 17^ |
|
||||
]],
|
||||
}
|
||||
]])
|
||||
|
||||
feed [[<cr>]]
|
||||
screen:expect {
|
||||
grid = [[
|
||||
screen:expect([[
|
||||
tty ready |
|
||||
^ |
|
||||
|*4
|
||||
{3:-- TERMINAL --} |
|
||||
]],
|
||||
}
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq('t', fn.mode(1))
|
||||
end)
|
||||
|
||||
@@ -329,9 +323,9 @@ describe(':terminal buffer', function()
|
||||
api.nvim_set_current_buf(term_buf)
|
||||
screen:expect([[
|
||||
tty ready │ |
|
||||
^rows: 5, cols: 25 │{4:~ }|
|
||||
│{4:~ }|*3
|
||||
{17:foo [-] }{1:[No Name] }|
|
||||
^rows: 5, cols: 25 │{100:~ }|
|
||||
│{100:~ }|*3
|
||||
{120:foo [-] }{2:[No Name] }|
|
||||
|
|
||||
]])
|
||||
|
||||
@@ -684,10 +678,10 @@ describe('terminal input', function()
|
||||
})
|
||||
screen:expect([[
|
||||
^ |
|
||||
{4:~ }|*3
|
||||
{5:[No Name] 0,0-1 All}|
|
||||
{100:~ }|*3
|
||||
{3:[No Name] 0,0-1 All}|
|
||||
|
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
local keys = {
|
||||
'<Tab>',
|
||||
@@ -769,10 +763,10 @@ describe('terminal input', function()
|
||||
feed(key)
|
||||
screen:expect(([[
|
||||
|
|
||||
{4:~ }|*3
|
||||
{5:[No Name] 0,0-1 All}|
|
||||
{100:~ }|*3
|
||||
{3:[No Name] 0,0-1 All}|
|
||||
%s^ {MATCH: *}|
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]]):format(key:gsub('<%d+,%d+>$', '')))
|
||||
end
|
||||
end)
|
||||
|
@@ -144,80 +144,63 @@ describe('no crash when TermOpen autocommand', function()
|
||||
api.nvim_set_option_value('shell', testprg('shell-test'), {})
|
||||
command('set shellcmdflag=EXE shellredir= shellpipe= shellquote= shellxquote=')
|
||||
screen = Screen.new(60, 4)
|
||||
screen:set_default_attr_ids({
|
||||
[0] = { bold = true, foreground = Screen.colors.Blue },
|
||||
})
|
||||
end)
|
||||
|
||||
it('processes job exit event when using jobstart(…,{term=true})', function()
|
||||
command([[autocmd TermOpen * call input('')]])
|
||||
async_meths.nvim_command('terminal foobar')
|
||||
screen:expect {
|
||||
grid = [[
|
||||
screen:expect([[
|
||||
|
|
||||
{0:~ }|*2
|
||||
{1:~ }|*2
|
||||
^ |
|
||||
]],
|
||||
}
|
||||
]])
|
||||
feed('<CR>')
|
||||
screen:expect {
|
||||
grid = [[
|
||||
screen:expect([[
|
||||
^ready $ foobar |
|
||||
|
|
||||
[Process exited 0] |
|
||||
|
|
||||
]],
|
||||
}
|
||||
]])
|
||||
feed('i<CR>')
|
||||
screen:expect {
|
||||
grid = [[
|
||||
screen:expect([[
|
||||
^ |
|
||||
{0:~ }|*2
|
||||
{1:~ }|*2
|
||||
|
|
||||
]],
|
||||
}
|
||||
]])
|
||||
assert_alive()
|
||||
end)
|
||||
|
||||
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 {
|
||||
grid = [[
|
||||
screen:expect([[
|
||||
|
|
||||
{0:~ }|*2
|
||||
{1:~ }|*2
|
||||
^ |
|
||||
]],
|
||||
}
|
||||
]])
|
||||
feed('<CR>')
|
||||
screen:expect {
|
||||
grid = [[
|
||||
screen:expect([[
|
||||
^ |
|
||||
{0:~ }|*2
|
||||
{1:~ }|*2
|
||||
|
|
||||
]],
|
||||
}
|
||||
]])
|
||||
assert_alive()
|
||||
end)
|
||||
|
||||
it('wipes buffer and processes events when using nvim_open_term()', function()
|
||||
command([[autocmd TermOpen * bwipe! | call input('')]])
|
||||
async_meths.nvim_open_term(0, {})
|
||||
screen:expect {
|
||||
grid = [[
|
||||
screen:expect([[
|
||||
|
|
||||
{0:~ }|*2
|
||||
{1:~ }|*2
|
||||
^ |
|
||||
]],
|
||||
}
|
||||
]])
|
||||
feed('<CR>')
|
||||
screen:expect {
|
||||
grid = [[
|
||||
screen:expect([[
|
||||
^ |
|
||||
{0:~ }|*2
|
||||
{1:~ }|*2
|
||||
|
|
||||
]],
|
||||
}
|
||||
]])
|
||||
assert_alive()
|
||||
end)
|
||||
end)
|
||||
@@ -236,8 +219,7 @@ describe('nvim_open_term', function()
|
||||
local term = api.nvim_open_term(buf, { force_crlf = true })
|
||||
api.nvim_win_set_buf(win, buf)
|
||||
api.nvim_chan_send(term, 'here\nthere\nfoo\r\nbar\n\ntest')
|
||||
screen:expect {
|
||||
grid = [[
|
||||
screen:expect([[
|
||||
^here |
|
||||
there |
|
||||
foo |
|
||||
@@ -245,11 +227,9 @@ describe('nvim_open_term', function()
|
||||
|
|
||||
test |
|
||||
|*4
|
||||
]],
|
||||
}
|
||||
]])
|
||||
api.nvim_chan_send(term, '\nfirst')
|
||||
screen:expect {
|
||||
grid = [[
|
||||
screen:expect([[
|
||||
^here |
|
||||
there |
|
||||
foo |
|
||||
@@ -258,8 +238,7 @@ describe('nvim_open_term', function()
|
||||
test |
|
||||
first |
|
||||
|*3
|
||||
]],
|
||||
}
|
||||
]])
|
||||
end)
|
||||
|
||||
it('with force_crlf=false does not convert newlines', function()
|
||||
@@ -268,10 +247,10 @@ describe('nvim_open_term', function()
|
||||
local term = api.nvim_open_term(buf, { force_crlf = false })
|
||||
api.nvim_win_set_buf(win, buf)
|
||||
api.nvim_chan_send(term, 'here\nthere')
|
||||
screen:expect { grid = [[
|
||||
screen:expect([[
|
||||
^here |
|
||||
there |
|
||||
|*8
|
||||
]] }
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
|
@@ -37,7 +37,7 @@ describe(':terminal cursor', function()
|
||||
tty ready |
|
||||
testing cursor^ |
|
||||
|*4
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end)
|
||||
|
||||
@@ -57,36 +57,36 @@ describe(':terminal cursor', function()
|
||||
|
||||
it('is positioned correctly when unfocused', function()
|
||||
screen:expect([[
|
||||
{7: 1 }tty ready |
|
||||
{7: 2 }^rows: 6, cols: 46 |
|
||||
{7: 3 } |
|
||||
{7: 4 } |
|
||||
{7: 5 } |
|
||||
{7: 6 } |
|
||||
{121: 1 }tty ready |
|
||||
{121: 2 }^rows: 6, cols: 46 |
|
||||
{121: 3 } |
|
||||
{121: 4 } |
|
||||
{121: 5 } |
|
||||
{121: 6 } |
|
||||
:set number |
|
||||
]])
|
||||
end)
|
||||
|
||||
it('is positioned correctly when focused', function()
|
||||
screen:expect([[
|
||||
{7: 1 }tty ready |
|
||||
{7: 2 }^rows: 6, cols: 46 |
|
||||
{7: 3 } |
|
||||
{7: 4 } |
|
||||
{7: 5 } |
|
||||
{7: 6 } |
|
||||
{121: 1 }tty ready |
|
||||
{121: 2 }^rows: 6, cols: 46 |
|
||||
{121: 3 } |
|
||||
{121: 4 } |
|
||||
{121: 5 } |
|
||||
{121: 6 } |
|
||||
:set number |
|
||||
]])
|
||||
feed('i')
|
||||
n.poke_eventloop()
|
||||
screen:expect([[
|
||||
{7: 1 }tty ready |
|
||||
{7: 2 }rows: 6, cols: 46 |
|
||||
{7: 3 }^ |
|
||||
{7: 4 } |
|
||||
{7: 5 } |
|
||||
{7: 6 } |
|
||||
{3:-- TERMINAL --} |
|
||||
{121: 1 }tty ready |
|
||||
{121: 2 }rows: 6, cols: 46 |
|
||||
{121: 3 }^ |
|
||||
{121: 4 } |
|
||||
{121: 5 } |
|
||||
{121: 6 } |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
@@ -98,35 +98,25 @@ describe(':terminal cursor', function()
|
||||
screen:expect([[
|
||||
tty ready |
|
||||
|*5
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
show_cursor()
|
||||
screen:expect([[
|
||||
tty ready |
|
||||
^ |
|
||||
|*4
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
-- same for when the terminal is unfocused
|
||||
feed('<c-\\><c-n>')
|
||||
hide_cursor()
|
||||
screen:expect({
|
||||
grid = [[
|
||||
screen:expect([[
|
||||
tty ready |
|
||||
^ |
|
||||
|*5
|
||||
]],
|
||||
unchanged = true,
|
||||
})
|
||||
]])
|
||||
show_cursor()
|
||||
screen:expect({
|
||||
grid = [[
|
||||
tty ready |
|
||||
^ |
|
||||
|*5
|
||||
]],
|
||||
unchanged = true,
|
||||
})
|
||||
screen:expect_unchanged()
|
||||
end)
|
||||
|
||||
it('becomes visible when exiting Terminal mode', function()
|
||||
@@ -135,7 +125,7 @@ describe(':terminal cursor', function()
|
||||
screen:expect([[
|
||||
tty ready |
|
||||
|*5
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
feed('<c-\\><c-n>')
|
||||
screen:expect([[
|
||||
@@ -147,7 +137,7 @@ describe(':terminal cursor', function()
|
||||
screen:expect([[
|
||||
tty ready |
|
||||
|*5
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
|
||||
-- Cursor is hidden; now request to show it while in a TermLeave autocmd.
|
||||
@@ -169,22 +159,22 @@ describe(':terminal cursor', function()
|
||||
command([[call chansend(chan, "\e[?25l") | new floob | call chansend(chan, "\e[?25h")]])
|
||||
screen:expect([[
|
||||
^ |
|
||||
{4:~ }|
|
||||
{5:floob }|
|
||||
{100:~ }|
|
||||
{3:floob }|
|
||||
|*2
|
||||
{18:[Scratch] [-] }|
|
||||
{119:[Scratch] [-] }|
|
||||
|
|
||||
]])
|
||||
|
||||
feed('<C-W>pi')
|
||||
screen:expect([[
|
||||
|
|
||||
{4:~ }|
|
||||
{1:floob }|
|
||||
{100:~ }|
|
||||
{2:floob }|
|
||||
^ |
|
||||
|
|
||||
{17:[Scratch] [-] }|
|
||||
{3:-- TERMINAL --} |
|
||||
{120:[Scratch] [-] }|
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end)
|
||||
|
||||
@@ -207,7 +197,7 @@ describe(':terminal cursor', function()
|
||||
screen:expect([[
|
||||
tty ready |
|
||||
|*5
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
|
||||
feed([[<C-\><C-N>]])
|
||||
@@ -235,11 +225,11 @@ describe(':terminal cursor', function()
|
||||
tt.feed_csi(('%d q'):format(k))
|
||||
screen:expect({
|
||||
grid = [[
|
||||
tty ready |
|
||||
^ |
|
||||
|*4
|
||||
{3:-- TERMINAL --} |
|
||||
]],
|
||||
tty ready |
|
||||
^ |
|
||||
|*4
|
||||
{5:-- TERMINAL --} |
|
||||
]],
|
||||
condition = function()
|
||||
if v.blink then
|
||||
eq(500, screen._mode_info[terminal_mode_idx].blinkon)
|
||||
@@ -282,11 +272,11 @@ describe(':terminal cursor', function()
|
||||
tt.feed_csi('5 q')
|
||||
screen:expect({
|
||||
grid = [[
|
||||
tty ready |
|
||||
^ |
|
||||
|*4
|
||||
{3:-- TERMINAL --} |
|
||||
]],
|
||||
tty ready |
|
||||
^ |
|
||||
|*4
|
||||
{5:-- TERMINAL --} |
|
||||
]],
|
||||
condition = function()
|
||||
eq(500, screen._mode_info[terminal_mode_idx].blinkon)
|
||||
eq(500, screen._mode_info[terminal_mode_idx].blinkoff)
|
||||
@@ -297,11 +287,11 @@ describe(':terminal cursor', function()
|
||||
tt.hide_cursor()
|
||||
screen:expect({
|
||||
grid = [[
|
||||
tty ready |
|
||||
|
|
||||
|*4
|
||||
{3:-- TERMINAL --} |
|
||||
]],
|
||||
tty ready |
|
||||
|
|
||||
|*4
|
||||
{5:-- TERMINAL --} |
|
||||
]],
|
||||
condition = function()
|
||||
eq(500, screen._mode_info[terminal_mode_idx].blinkon)
|
||||
eq(500, screen._mode_info[terminal_mode_idx].blinkoff)
|
||||
@@ -318,14 +308,14 @@ describe(':terminal cursor', function()
|
||||
feed('i')
|
||||
screen:expect({
|
||||
grid = [[
|
||||
tty ready |
|
||||
^ |
|
||||
{17:~~~ }|
|
||||
rows: 2, cols: 50 |
|
||||
|
|
||||
{18:~~~ }|
|
||||
{3:-- TERMINAL --} |
|
||||
]],
|
||||
tty ready |
|
||||
^ |
|
||||
{120:~~~ }|
|
||||
rows: 2, cols: 50 |
|
||||
|
|
||||
{119:~~~ }|
|
||||
{5:-- TERMINAL --} |
|
||||
]],
|
||||
condition = function()
|
||||
-- New terminal, cursor resets to defaults
|
||||
eq(500, screen._mode_info[terminal_mode_idx].blinkon)
|
||||
@@ -338,14 +328,14 @@ describe(':terminal cursor', function()
|
||||
tt.feed_csi('4 q')
|
||||
screen:expect({
|
||||
grid = [[
|
||||
tty ready |
|
||||
^ |
|
||||
{17:~~~ }|
|
||||
rows: 2, cols: 50 |
|
||||
|
|
||||
{18:~~~ }|
|
||||
{3:-- TERMINAL --} |
|
||||
]],
|
||||
tty ready |
|
||||
^ |
|
||||
{120:~~~ }|
|
||||
rows: 2, cols: 50 |
|
||||
|
|
||||
{119:~~~ }|
|
||||
{5:-- TERMINAL --} |
|
||||
]],
|
||||
condition = function()
|
||||
eq(0, screen._mode_info[terminal_mode_idx].blinkon)
|
||||
eq(0, screen._mode_info[terminal_mode_idx].blinkoff)
|
||||
@@ -357,14 +347,14 @@ describe(':terminal cursor', function()
|
||||
command('wincmd p')
|
||||
screen:expect({
|
||||
grid = [[
|
||||
tty ready |
|
||||
|
|
||||
{18:~~~ }|
|
||||
rows: 2, cols: 50 |
|
||||
|
|
||||
{17:~~~ }|
|
||||
{3:-- TERMINAL --} |
|
||||
]],
|
||||
tty ready |
|
||||
|
|
||||
{119:~~~ }|
|
||||
rows: 2, cols: 50 |
|
||||
|
|
||||
{120:~~~ }|
|
||||
{5:-- TERMINAL --} |
|
||||
]],
|
||||
condition = function()
|
||||
eq(500, screen._mode_info[terminal_mode_idx].blinkon)
|
||||
eq(500, screen._mode_info[terminal_mode_idx].blinkoff)
|
||||
@@ -387,7 +377,7 @@ describe(':terminal cursor', function()
|
||||
^ |
|
||||
~ |*4
|
||||
|
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
|
||||
feed('i<Tab>')
|
||||
@@ -395,7 +385,7 @@ describe(':terminal cursor', function()
|
||||
^ |
|
||||
~ |*4
|
||||
|
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end)
|
||||
|
||||
@@ -437,8 +427,8 @@ describe(':terminal cursor', function()
|
||||
screen:expect([[
|
||||
^ │ |
|
||||
│ |*4
|
||||
{17:[Scratch] [-] }{18:[Scratch] [-] }|
|
||||
{3:-- TERMINAL --} |
|
||||
{120:[Scratch] [-] }{119:[Scratch] [-] }|
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq('block', screen._mode_info[terminal_mode_idx].cursor_shape)
|
||||
eq(500, screen._mode_info[terminal_mode_idx].blinkon)
|
||||
@@ -463,8 +453,8 @@ describe(':terminal cursor', function()
|
||||
screen:expect([[
|
||||
│^ |
|
||||
│ |*4
|
||||
{18:[Scratch] [-] }{17:[Scratch] [-] }|
|
||||
{3:-- TERMINAL --} |
|
||||
{119:[Scratch] [-] }{120:[Scratch] [-] }|
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq('horizontal', screen._mode_info[terminal_mode_idx].cursor_shape)
|
||||
eq(0, screen._mode_info[terminal_mode_idx].blinkon)
|
||||
@@ -498,7 +488,7 @@ describe('buffer cursor position is correct in terminal without number column',
|
||||
|*4
|
||||
Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
:^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end
|
||||
|
||||
@@ -515,7 +505,7 @@ describe('buffer cursor position is correct in terminal without number column',
|
||||
|*4
|
||||
Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
:aaaaaaaa^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq({ 6, 9 }, eval('nvim_win_get_cursor(0)'))
|
||||
feed([[<C-\><C-N>]])
|
||||
@@ -534,7 +524,7 @@ describe('buffer cursor position is correct in terminal without number column',
|
||||
|*4
|
||||
Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
:aaaaaa^aa |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq({ 6, 7 }, eval('nvim_win_get_cursor(0)'))
|
||||
feed([[<C-\><C-N>]])
|
||||
@@ -553,7 +543,7 @@ describe('buffer cursor position is correct in terminal without number column',
|
||||
|*4
|
||||
Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
:a^aaaaaaa |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq({ 6, 2 }, eval('nvim_win_get_cursor(0)'))
|
||||
feed([[<C-\><C-N>]])
|
||||
@@ -578,7 +568,7 @@ describe('buffer cursor position is correct in terminal without number column',
|
||||
|*4
|
||||
Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
:µµµµµµµµ^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq({ 6, 17 }, eval('nvim_win_get_cursor(0)'))
|
||||
feed([[<C-\><C-N>]])
|
||||
@@ -597,7 +587,7 @@ describe('buffer cursor position is correct in terminal without number column',
|
||||
|*4
|
||||
Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
:µµµµµµ^µµ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq({ 6, 13 }, eval('nvim_win_get_cursor(0)'))
|
||||
feed([[<C-\><C-N>]])
|
||||
@@ -616,7 +606,7 @@ describe('buffer cursor position is correct in terminal without number column',
|
||||
|*4
|
||||
Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
:µ^µµµµµµµ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq({ 6, 3 }, eval('nvim_win_get_cursor(0)'))
|
||||
feed([[<C-\><C-N>]])
|
||||
@@ -641,7 +631,7 @@ describe('buffer cursor position is correct in terminal without number column',
|
||||
|*4
|
||||
Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
:µ̳µ̳µ̳µ̳µ̳µ̳µ̳µ̳^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq({ 6, 33 }, eval('nvim_win_get_cursor(0)'))
|
||||
feed([[<C-\><C-N>]])
|
||||
@@ -661,7 +651,7 @@ describe('buffer cursor position is correct in terminal without number column',
|
||||
|*4
|
||||
Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
:µ̳µ̳µ̳µ̳µ̳µ̳^µ̳µ̳ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq({ 6, 25 }, eval('nvim_win_get_cursor(0)'))
|
||||
feed([[<C-\><C-N>]])
|
||||
@@ -681,7 +671,7 @@ describe('buffer cursor position is correct in terminal without number column',
|
||||
|*4
|
||||
Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
:µ̳^µ̳µ̳µ̳µ̳µ̳µ̳µ̳ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq({ 6, 5 }, eval('nvim_win_get_cursor(0)'))
|
||||
feed([[<C-\><C-N>]])
|
||||
@@ -706,7 +696,7 @@ describe('buffer cursor position is correct in terminal without number column',
|
||||
|*4
|
||||
Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
:哦哦哦哦哦哦哦哦^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq({ 6, 25 }, eval('nvim_win_get_cursor(0)'))
|
||||
feed([[<C-\><C-N>]])
|
||||
@@ -725,7 +715,7 @@ describe('buffer cursor position is correct in terminal without number column',
|
||||
|*4
|
||||
Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
:哦哦哦哦哦哦^哦哦 |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq({ 6, 19 }, eval('nvim_win_get_cursor(0)'))
|
||||
feed([[<C-\><C-N>]])
|
||||
@@ -744,7 +734,7 @@ describe('buffer cursor position is correct in terminal without number column',
|
||||
|*4
|
||||
Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
:哦^哦哦哦哦哦哦哦 |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq({ 6, 4 }, eval('nvim_win_get_cursor(0)'))
|
||||
feed([[<C-\><C-N>]])
|
||||
@@ -765,7 +755,7 @@ describe('buffer cursor position is correct in terminal without number column',
|
||||
|*4
|
||||
Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
:aaaaaaaa ^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
matches('^:aaaaaaaa [ ]*$', eval('nvim_get_current_line()'))
|
||||
eq({ 6, 13 }, eval('nvim_win_get_cursor(0)'))
|
||||
@@ -807,13 +797,13 @@ describe('buffer cursor position is correct in terminal with number column', fun
|
||||
cols = 70,
|
||||
})
|
||||
screen:expect([[
|
||||
{7: 1 } |
|
||||
{7: 2 } |
|
||||
{7: 3 } |
|
||||
{7: 4 } |
|
||||
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{7: 6 }:^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{121: 1 } |
|
||||
{121: 2 } |
|
||||
{121: 3 } |
|
||||
{121: 4 } |
|
||||
{121: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{121: 6 }:^ |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end
|
||||
|
||||
@@ -830,23 +820,23 @@ describe('buffer cursor position is correct in terminal with number column', fun
|
||||
it('at the end', function()
|
||||
feed('<C-R>r')
|
||||
screen:expect([[
|
||||
{7: 1 } |
|
||||
{7: 2 } |
|
||||
{7: 3 } |
|
||||
{7: 4 } |
|
||||
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{7: 6 }:aaaaaaaa^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{121: 1 } |
|
||||
{121: 2 } |
|
||||
{121: 3 } |
|
||||
{121: 4 } |
|
||||
{121: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{121: 6 }:aaaaaaaa^ |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq({ 6, 9 }, eval('nvim_win_get_cursor(0)'))
|
||||
feed([[<C-\><C-N>]])
|
||||
screen:expect([[
|
||||
{7: 1 } |
|
||||
{7: 2 } |
|
||||
{7: 3 } |
|
||||
{7: 4 } |
|
||||
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{7: 6 }:aaaaaaa^a |
|
||||
{121: 1 } |
|
||||
{121: 2 } |
|
||||
{121: 3 } |
|
||||
{121: 4 } |
|
||||
{121: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{121: 6 }:aaaaaaa^a |
|
||||
|
|
||||
]])
|
||||
eq({ 6, 8 }, eval('nvim_win_get_cursor(0)'))
|
||||
@@ -855,23 +845,23 @@ describe('buffer cursor position is correct in terminal with number column', fun
|
||||
it('near the end', function()
|
||||
feed('<C-R>r<C-X><C-X>')
|
||||
screen:expect([[
|
||||
{7: 1 } |
|
||||
{7: 2 } |
|
||||
{7: 3 } |
|
||||
{7: 4 } |
|
||||
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{7: 6 }:aaaaaa^aa |
|
||||
{3:-- TERMINAL --} |
|
||||
{121: 1 } |
|
||||
{121: 2 } |
|
||||
{121: 3 } |
|
||||
{121: 4 } |
|
||||
{121: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{121: 6 }:aaaaaa^aa |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq({ 6, 7 }, eval('nvim_win_get_cursor(0)'))
|
||||
feed([[<C-\><C-N>]])
|
||||
screen:expect([[
|
||||
{7: 1 } |
|
||||
{7: 2 } |
|
||||
{7: 3 } |
|
||||
{7: 4 } |
|
||||
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{7: 6 }:aaaaa^aaa |
|
||||
{121: 1 } |
|
||||
{121: 2 } |
|
||||
{121: 3 } |
|
||||
{121: 4 } |
|
||||
{121: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{121: 6 }:aaaaa^aaa |
|
||||
|
|
||||
]])
|
||||
eq({ 6, 6 }, eval('nvim_win_get_cursor(0)'))
|
||||
@@ -880,23 +870,23 @@ describe('buffer cursor position is correct in terminal with number column', fun
|
||||
it('near the start', function()
|
||||
feed('<C-R>r<C-B><C-O>')
|
||||
screen:expect([[
|
||||
{7: 1 } |
|
||||
{7: 2 } |
|
||||
{7: 3 } |
|
||||
{7: 4 } |
|
||||
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{7: 6 }:a^aaaaaaa |
|
||||
{3:-- TERMINAL --} |
|
||||
{121: 1 } |
|
||||
{121: 2 } |
|
||||
{121: 3 } |
|
||||
{121: 4 } |
|
||||
{121: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{121: 6 }:a^aaaaaaa |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq({ 6, 2 }, eval('nvim_win_get_cursor(0)'))
|
||||
feed([[<C-\><C-N>]])
|
||||
screen:expect([[
|
||||
{7: 1 } |
|
||||
{7: 2 } |
|
||||
{7: 3 } |
|
||||
{7: 4 } |
|
||||
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{7: 6 }:^aaaaaaaa |
|
||||
{121: 1 } |
|
||||
{121: 2 } |
|
||||
{121: 3 } |
|
||||
{121: 4 } |
|
||||
{121: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{121: 6 }:^aaaaaaaa |
|
||||
|
|
||||
]])
|
||||
eq({ 6, 1 }, eval('nvim_win_get_cursor(0)'))
|
||||
@@ -911,23 +901,23 @@ describe('buffer cursor position is correct in terminal with number column', fun
|
||||
it('at the end', function()
|
||||
feed('<C-R>r')
|
||||
screen:expect([[
|
||||
{7: 1 } |
|
||||
{7: 2 } |
|
||||
{7: 3 } |
|
||||
{7: 4 } |
|
||||
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{7: 6 }:µµµµµµµµ^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{121: 1 } |
|
||||
{121: 2 } |
|
||||
{121: 3 } |
|
||||
{121: 4 } |
|
||||
{121: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{121: 6 }:µµµµµµµµ^ |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq({ 6, 17 }, eval('nvim_win_get_cursor(0)'))
|
||||
feed([[<C-\><C-N>]])
|
||||
screen:expect([[
|
||||
{7: 1 } |
|
||||
{7: 2 } |
|
||||
{7: 3 } |
|
||||
{7: 4 } |
|
||||
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{7: 6 }:µµµµµµµ^µ |
|
||||
{121: 1 } |
|
||||
{121: 2 } |
|
||||
{121: 3 } |
|
||||
{121: 4 } |
|
||||
{121: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{121: 6 }:µµµµµµµ^µ |
|
||||
|
|
||||
]])
|
||||
eq({ 6, 15 }, eval('nvim_win_get_cursor(0)'))
|
||||
@@ -936,23 +926,23 @@ describe('buffer cursor position is correct in terminal with number column', fun
|
||||
it('near the end', function()
|
||||
feed('<C-R>r<C-X><C-X>')
|
||||
screen:expect([[
|
||||
{7: 1 } |
|
||||
{7: 2 } |
|
||||
{7: 3 } |
|
||||
{7: 4 } |
|
||||
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{7: 6 }:µµµµµµ^µµ |
|
||||
{3:-- TERMINAL --} |
|
||||
{121: 1 } |
|
||||
{121: 2 } |
|
||||
{121: 3 } |
|
||||
{121: 4 } |
|
||||
{121: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{121: 6 }:µµµµµµ^µµ |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq({ 6, 13 }, eval('nvim_win_get_cursor(0)'))
|
||||
feed([[<C-\><C-N>]])
|
||||
screen:expect([[
|
||||
{7: 1 } |
|
||||
{7: 2 } |
|
||||
{7: 3 } |
|
||||
{7: 4 } |
|
||||
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{7: 6 }:µµµµµ^µµµ |
|
||||
{121: 1 } |
|
||||
{121: 2 } |
|
||||
{121: 3 } |
|
||||
{121: 4 } |
|
||||
{121: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{121: 6 }:µµµµµ^µµµ |
|
||||
|
|
||||
]])
|
||||
eq({ 6, 11 }, eval('nvim_win_get_cursor(0)'))
|
||||
@@ -961,23 +951,23 @@ describe('buffer cursor position is correct in terminal with number column', fun
|
||||
it('near the start', function()
|
||||
feed('<C-R>r<C-B><C-O>')
|
||||
screen:expect([[
|
||||
{7: 1 } |
|
||||
{7: 2 } |
|
||||
{7: 3 } |
|
||||
{7: 4 } |
|
||||
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{7: 6 }:µ^µµµµµµµ |
|
||||
{3:-- TERMINAL --} |
|
||||
{121: 1 } |
|
||||
{121: 2 } |
|
||||
{121: 3 } |
|
||||
{121: 4 } |
|
||||
{121: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{121: 6 }:µ^µµµµµµµ |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq({ 6, 3 }, eval('nvim_win_get_cursor(0)'))
|
||||
feed([[<C-\><C-N>]])
|
||||
screen:expect([[
|
||||
{7: 1 } |
|
||||
{7: 2 } |
|
||||
{7: 3 } |
|
||||
{7: 4 } |
|
||||
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{7: 6 }:^µµµµµµµµ |
|
||||
{121: 1 } |
|
||||
{121: 2 } |
|
||||
{121: 3 } |
|
||||
{121: 4 } |
|
||||
{121: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{121: 6 }:^µµµµµµµµ |
|
||||
|
|
||||
]])
|
||||
eq({ 6, 1 }, eval('nvim_win_get_cursor(0)'))
|
||||
@@ -992,23 +982,23 @@ describe('buffer cursor position is correct in terminal with number column', fun
|
||||
it('at the end', function()
|
||||
feed('<C-R>r')
|
||||
screen:expect([[
|
||||
{7: 1 } |
|
||||
{7: 2 } |
|
||||
{7: 3 } |
|
||||
{7: 4 } |
|
||||
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{7: 6 }:µ̳µ̳µ̳µ̳µ̳µ̳µ̳µ̳^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{121: 1 } |
|
||||
{121: 2 } |
|
||||
{121: 3 } |
|
||||
{121: 4 } |
|
||||
{121: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{121: 6 }:µ̳µ̳µ̳µ̳µ̳µ̳µ̳µ̳^ |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq({ 6, 33 }, eval('nvim_win_get_cursor(0)'))
|
||||
feed([[<C-\><C-N>]])
|
||||
screen:expect([[
|
||||
{7: 1 } |
|
||||
{7: 2 } |
|
||||
{7: 3 } |
|
||||
{7: 4 } |
|
||||
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{7: 6 }:µ̳µ̳µ̳µ̳µ̳µ̳µ̳^µ̳ |
|
||||
{121: 1 } |
|
||||
{121: 2 } |
|
||||
{121: 3 } |
|
||||
{121: 4 } |
|
||||
{121: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{121: 6 }:µ̳µ̳µ̳µ̳µ̳µ̳µ̳^µ̳ |
|
||||
|
|
||||
]])
|
||||
eq({ 6, 29 }, eval('nvim_win_get_cursor(0)'))
|
||||
@@ -1018,23 +1008,23 @@ describe('buffer cursor position is correct in terminal with number column', fun
|
||||
skip(is_os('win'))
|
||||
feed('<C-R>r<C-X><C-X>')
|
||||
screen:expect([[
|
||||
{7: 1 } |
|
||||
{7: 2 } |
|
||||
{7: 3 } |
|
||||
{7: 4 } |
|
||||
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{7: 6 }:µ̳µ̳µ̳µ̳µ̳µ̳^µ̳µ̳ |
|
||||
{3:-- TERMINAL --} |
|
||||
{121: 1 } |
|
||||
{121: 2 } |
|
||||
{121: 3 } |
|
||||
{121: 4 } |
|
||||
{121: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{121: 6 }:µ̳µ̳µ̳µ̳µ̳µ̳^µ̳µ̳ |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq({ 6, 25 }, eval('nvim_win_get_cursor(0)'))
|
||||
feed([[<C-\><C-N>]])
|
||||
screen:expect([[
|
||||
{7: 1 } |
|
||||
{7: 2 } |
|
||||
{7: 3 } |
|
||||
{7: 4 } |
|
||||
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{7: 6 }:µ̳µ̳µ̳µ̳µ̳^µ̳µ̳µ̳ |
|
||||
{121: 1 } |
|
||||
{121: 2 } |
|
||||
{121: 3 } |
|
||||
{121: 4 } |
|
||||
{121: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{121: 6 }:µ̳µ̳µ̳µ̳µ̳^µ̳µ̳µ̳ |
|
||||
|
|
||||
]])
|
||||
eq({ 6, 21 }, eval('nvim_win_get_cursor(0)'))
|
||||
@@ -1044,23 +1034,23 @@ describe('buffer cursor position is correct in terminal with number column', fun
|
||||
skip(is_os('win'))
|
||||
feed('<C-R>r<C-B><C-O>')
|
||||
screen:expect([[
|
||||
{7: 1 } |
|
||||
{7: 2 } |
|
||||
{7: 3 } |
|
||||
{7: 4 } |
|
||||
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{7: 6 }:µ̳^µ̳µ̳µ̳µ̳µ̳µ̳µ̳ |
|
||||
{3:-- TERMINAL --} |
|
||||
{121: 1 } |
|
||||
{121: 2 } |
|
||||
{121: 3 } |
|
||||
{121: 4 } |
|
||||
{121: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{121: 6 }:µ̳^µ̳µ̳µ̳µ̳µ̳µ̳µ̳ |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq({ 6, 5 }, eval('nvim_win_get_cursor(0)'))
|
||||
feed([[<C-\><C-N>]])
|
||||
screen:expect([[
|
||||
{7: 1 } |
|
||||
{7: 2 } |
|
||||
{7: 3 } |
|
||||
{7: 4 } |
|
||||
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{7: 6 }:^µ̳µ̳µ̳µ̳µ̳µ̳µ̳µ̳ |
|
||||
{121: 1 } |
|
||||
{121: 2 } |
|
||||
{121: 3 } |
|
||||
{121: 4 } |
|
||||
{121: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{121: 6 }:^µ̳µ̳µ̳µ̳µ̳µ̳µ̳µ̳ |
|
||||
|
|
||||
]])
|
||||
eq({ 6, 1 }, eval('nvim_win_get_cursor(0)'))
|
||||
@@ -1075,23 +1065,23 @@ describe('buffer cursor position is correct in terminal with number column', fun
|
||||
it('at the end', function()
|
||||
feed('<C-R>r')
|
||||
screen:expect([[
|
||||
{7: 1 } |
|
||||
{7: 2 } |
|
||||
{7: 3 } |
|
||||
{7: 4 } |
|
||||
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{7: 6 }:哦哦哦哦哦哦哦哦^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{121: 1 } |
|
||||
{121: 2 } |
|
||||
{121: 3 } |
|
||||
{121: 4 } |
|
||||
{121: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{121: 6 }:哦哦哦哦哦哦哦哦^ |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq({ 6, 25 }, eval('nvim_win_get_cursor(0)'))
|
||||
feed([[<C-\><C-N>]])
|
||||
screen:expect([[
|
||||
{7: 1 } |
|
||||
{7: 2 } |
|
||||
{7: 3 } |
|
||||
{7: 4 } |
|
||||
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{7: 6 }:哦哦哦哦哦哦哦^哦 |
|
||||
{121: 1 } |
|
||||
{121: 2 } |
|
||||
{121: 3 } |
|
||||
{121: 4 } |
|
||||
{121: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{121: 6 }:哦哦哦哦哦哦哦^哦 |
|
||||
|
|
||||
]])
|
||||
eq({ 6, 22 }, eval('nvim_win_get_cursor(0)'))
|
||||
@@ -1100,23 +1090,23 @@ describe('buffer cursor position is correct in terminal with number column', fun
|
||||
it('near the end', function()
|
||||
feed('<C-R>r<C-X><C-X>')
|
||||
screen:expect([[
|
||||
{7: 1 } |
|
||||
{7: 2 } |
|
||||
{7: 3 } |
|
||||
{7: 4 } |
|
||||
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{7: 6 }:哦哦哦哦哦哦^哦哦 |
|
||||
{3:-- TERMINAL --} |
|
||||
{121: 1 } |
|
||||
{121: 2 } |
|
||||
{121: 3 } |
|
||||
{121: 4 } |
|
||||
{121: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{121: 6 }:哦哦哦哦哦哦^哦哦 |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq({ 6, 19 }, eval('nvim_win_get_cursor(0)'))
|
||||
feed([[<C-\><C-N>]])
|
||||
screen:expect([[
|
||||
{7: 1 } |
|
||||
{7: 2 } |
|
||||
{7: 3 } |
|
||||
{7: 4 } |
|
||||
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{7: 6 }:哦哦哦哦哦^哦哦哦 |
|
||||
{121: 1 } |
|
||||
{121: 2 } |
|
||||
{121: 3 } |
|
||||
{121: 4 } |
|
||||
{121: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{121: 6 }:哦哦哦哦哦^哦哦哦 |
|
||||
|
|
||||
]])
|
||||
eq({ 6, 16 }, eval('nvim_win_get_cursor(0)'))
|
||||
@@ -1125,23 +1115,23 @@ describe('buffer cursor position is correct in terminal with number column', fun
|
||||
it('near the start', function()
|
||||
feed('<C-R>r<C-B><C-O>')
|
||||
screen:expect([[
|
||||
{7: 1 } |
|
||||
{7: 2 } |
|
||||
{7: 3 } |
|
||||
{7: 4 } |
|
||||
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{7: 6 }:哦^哦哦哦哦哦哦哦 |
|
||||
{3:-- TERMINAL --} |
|
||||
{121: 1 } |
|
||||
{121: 2 } |
|
||||
{121: 3 } |
|
||||
{121: 4 } |
|
||||
{121: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{121: 6 }:哦^哦哦哦哦哦哦哦 |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq({ 6, 4 }, eval('nvim_win_get_cursor(0)'))
|
||||
feed([[<C-\><C-N>]])
|
||||
screen:expect([[
|
||||
{7: 1 } |
|
||||
{7: 2 } |
|
||||
{7: 3 } |
|
||||
{7: 4 } |
|
||||
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{7: 6 }:^哦哦哦哦哦哦哦哦 |
|
||||
{121: 1 } |
|
||||
{121: 2 } |
|
||||
{121: 3 } |
|
||||
{121: 4 } |
|
||||
{121: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{121: 6 }:^哦哦哦哦哦哦哦哦 |
|
||||
|
|
||||
]])
|
||||
eq({ 6, 1 }, eval('nvim_win_get_cursor(0)'))
|
||||
@@ -1152,24 +1142,24 @@ describe('buffer cursor position is correct in terminal with number column', fun
|
||||
setup_ex_register('aaaaaaaa ')
|
||||
feed('<C-R>r')
|
||||
screen:expect([[
|
||||
{7: 1 } |
|
||||
{7: 2 } |
|
||||
{7: 3 } |
|
||||
{7: 4 } |
|
||||
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{7: 6 }:aaaaaaaa ^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{121: 1 } |
|
||||
{121: 2 } |
|
||||
{121: 3 } |
|
||||
{121: 4 } |
|
||||
{121: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{121: 6 }:aaaaaaaa ^ |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
matches('^:aaaaaaaa [ ]*$', eval('nvim_get_current_line()'))
|
||||
eq({ 6, 13 }, eval('nvim_win_get_cursor(0)'))
|
||||
feed([[<C-\><C-N>]])
|
||||
screen:expect([[
|
||||
{7: 1 } |
|
||||
{7: 2 } |
|
||||
{7: 3 } |
|
||||
{7: 4 } |
|
||||
{7: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{7: 6 }:aaaaaaaa ^ |
|
||||
{121: 1 } |
|
||||
{121: 2 } |
|
||||
{121: 3 } |
|
||||
{121: 4 } |
|
||||
{121: 5 }Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||
{121: 6 }:aaaaaaaa ^ |
|
||||
|
|
||||
]])
|
||||
eq({ 6, 12 }, eval('nvim_win_get_cursor(0)'))
|
||||
|
@@ -194,13 +194,7 @@ end)
|
||||
it('CursorLine and CursorColumn work in :terminal buffer in Normal mode', function()
|
||||
clear()
|
||||
local screen = Screen.new(50, 7)
|
||||
screen:set_default_attr_ids({
|
||||
[1] = { background = Screen.colors.Grey90 }, -- CursorLine, CursorColumn
|
||||
[2] = { reverse = true },
|
||||
[3] = { bold = true }, -- ModeMsg
|
||||
[4] = { background = Screen.colors.Grey90, reverse = true },
|
||||
[5] = { background = Screen.colors.Red },
|
||||
})
|
||||
screen:add_extra_attr_ids({ [100] = { background = Screen.colors.Gray90, reverse = true } })
|
||||
command(("enew | call jobstart(['%s'], {'term':v:true})"):format(testprg('tty-test')))
|
||||
screen:expect([[
|
||||
^tty ready |
|
||||
@@ -219,12 +213,12 @@ it('CursorLine and CursorColumn work in :terminal buffer in Normal mode', functi
|
||||
command('set cursorline cursorcolumn')
|
||||
feed('j10w')
|
||||
screen:expect([[
|
||||
tty ready {1: } |
|
||||
foobar foobar{1: }foobar foobar foobar foobar foobar |
|
||||
{1:foobar foobar ^foobar 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 {1: } |
|
||||
tty ready {21: } |
|
||||
foobar foobar{21: }foobar foobar foobar foobar foobar |
|
||||
{21:foobar foobar ^foobar foobar foobar foobar foobar f}|
|
||||
oobar foobar f{21:o}obar foobar foobar foobar foobar fo|
|
||||
obar foobar fo{21:o}bar foobar foobar foobar foobar foo|
|
||||
bar foobar {21: } |
|
||||
|
|
||||
]])
|
||||
-- Entering terminal mode disables 'cursorline' and 'cursorcolumn'.
|
||||
@@ -236,17 +230,17 @@ it('CursorLine and CursorColumn work in :terminal buffer in Normal mode', functi
|
||||
oobar foobar foobar foobar foobar foobar foobar fo|
|
||||
obar foobar foobar foobar foobar foobar foobar foo|
|
||||
bar foobar^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
-- Leaving terminal mode restores old values.
|
||||
feed([[<C-\><C-N>]])
|
||||
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 }|
|
||||
tty ready{21: } |
|
||||
foobar f{21:o}obar foobar foobar foobar foobar foobar |
|
||||
foobar fo{21:o}bar foobar foobar foobar foobar foobar f|
|
||||
oobar foo{21:b}ar foobar foobar foobar foobar foobar fo|
|
||||
obar foob{21:a}r foobar foobar foobar foobar foobar foo|
|
||||
{21:bar fooba^r }|
|
||||
|
|
||||
]])
|
||||
|
||||
@@ -260,22 +254,22 @@ it('CursorLine and CursorColumn work in :terminal buffer in Normal mode', functi
|
||||
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: foobar}{1: }|
|
||||
tty ready{21: } |
|
||||
foobar f{21:o}obar foobar foobar foobar foobar foobar |
|
||||
foobar fo{21:o}bar foobar foobar foobar foobar foobar f|
|
||||
oobar foo{21:b}ar foobar foobar foobar foobar foobar fo|
|
||||
obar foob{21:a}r foobar foobar foobar foobar foobar foo|
|
||||
{21:bar fooba^r}{100: foobar}{21: }|
|
||||
|
|
||||
]])
|
||||
feed('2gg15|')
|
||||
screen:expect([[
|
||||
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} |
|
||||
tty ready {21: } |
|
||||
{21: foobar foobar^ foobar foobar foobar foobar foobar }|
|
||||
foobar foobar {21:f}oobar foobar foobar foobar foobar f|
|
||||
oobar foobar f{21:o}obar foobar foobar foobar foobar fo|
|
||||
obar foobar fo{21:o}bar foobar foobar foobar foobar foo|
|
||||
bar foobar{2: foo}{100:b}{2:ar} |
|
||||
|
|
||||
]])
|
||||
|
||||
@@ -287,22 +281,22 @@ it('CursorLine and CursorColumn work in :terminal buffer in Normal mode', functi
|
||||
|
||||
-- Terminal color has higher precedence
|
||||
screen:expect([[
|
||||
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} |
|
||||
tty ready {21: } |
|
||||
{21: foobar foobar foob^ar foobar foobar foobar foobar }|
|
||||
foobar foobar fooba{21:r} foobar foobar foobar foobar f|
|
||||
oobar foobar foobar{21: }foobar foobar foobar foobar fo|
|
||||
obar foobar foobar {21:f}oobar foobar foobar foobar foo|
|
||||
bar foobar{2: foobar}{30: foobar} |
|
||||
|
|
||||
]])
|
||||
feed('G$')
|
||||
screen:expect([[
|
||||
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: }|
|
||||
tty ready {21: } |
|
||||
foobar foobar foobar f{21:o}obar foobar foobar foobar |
|
||||
foobar foobar foobar fo{21:o}bar foobar foobar foobar f|
|
||||
oobar foobar foobar foo{21:b}ar foobar foobar foobar fo|
|
||||
obar foobar foobar foob{21:a}r foobar foobar foobar foo|
|
||||
{21:bar foobar}{100: foobar}{30: fooba^r}{21: }|
|
||||
|
|
||||
]])
|
||||
end)
|
||||
@@ -337,14 +331,12 @@ describe(':terminal highlight forwarding', function()
|
||||
tt.feed_data('color')
|
||||
tt.clear_attrs()
|
||||
tt.feed_data('text')
|
||||
screen:expect {
|
||||
grid = [[
|
||||
screen:expect([[
|
||||
tty ready |
|
||||
{2:text}{3:color}text^ |
|
||||
|*4
|
||||
{1:-- TERMINAL --} |
|
||||
]],
|
||||
}
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
|
||||
@@ -354,16 +346,6 @@ describe(':terminal highlight with custom palette', function()
|
||||
before_each(function()
|
||||
clear()
|
||||
screen = Screen.new(50, 7, { rgb = true })
|
||||
screen:set_default_attr_ids({
|
||||
[1] = { foreground = tonumber('0x123456') }, -- no fg_indexed when overridden
|
||||
[2] = { foreground = 12 },
|
||||
[3] = { bold = true, reverse = true },
|
||||
[5] = { background = 11 },
|
||||
[6] = { foreground = 130 },
|
||||
[7] = { reverse = true },
|
||||
[8] = { background = 11 },
|
||||
[9] = { bold = true },
|
||||
})
|
||||
api.nvim_set_var('terminal_color_3', '#123456')
|
||||
command(("enew | call jobstart(['%s'], {'term':v:true})"):format(testprg('tty-test')))
|
||||
feed('i')
|
||||
@@ -371,7 +353,7 @@ describe(':terminal highlight with custom palette', function()
|
||||
tty ready |
|
||||
^ |
|
||||
|*4
|
||||
{9:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end)
|
||||
|
||||
@@ -381,11 +363,12 @@ describe(':terminal highlight with custom palette', function()
|
||||
tt.feed_data('text')
|
||||
tt.clear_attrs()
|
||||
tt.feed_data('text')
|
||||
screen:add_extra_attr_ids({ [100] = { foreground = tonumber('0x123456') } })
|
||||
screen:expect([[
|
||||
tty ready |
|
||||
{1:text}text^ |
|
||||
{100:text}text^ |
|
||||
|*4
|
||||
{9:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
@@ -395,9 +378,7 @@ describe(':terminal', function()
|
||||
|
||||
it('can display URLs', function()
|
||||
local screen = Screen.new(50, 7)
|
||||
screen:add_extra_attr_ids {
|
||||
[100] = { url = 'https://example.com' },
|
||||
}
|
||||
screen:add_extra_attr_ids({ [100] = { url = 'https://example.com' } })
|
||||
local chan = api.nvim_open_term(0, {})
|
||||
api.nvim_chan_send(
|
||||
chan,
|
||||
|
@@ -33,7 +33,7 @@ describe(':terminal mouse', function()
|
||||
line29 |
|
||||
line30 |
|
||||
^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end)
|
||||
|
||||
@@ -108,7 +108,7 @@ describe(':terminal mouse', function()
|
||||
line30 |
|
||||
mouse enabled |
|
||||
^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end)
|
||||
|
||||
@@ -122,7 +122,7 @@ describe(':terminal mouse', function()
|
||||
line30 |
|
||||
mouse enabled |
|
||||
"#^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
feed('<LeftDrag><2,2>')
|
||||
screen:expect([[
|
||||
@@ -132,7 +132,7 @@ describe(':terminal mouse', function()
|
||||
line30 |
|
||||
mouse enabled |
|
||||
@##^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
feed('<LeftDrag><3,2>')
|
||||
screen:expect([[
|
||||
@@ -142,7 +142,7 @@ describe(':terminal mouse', function()
|
||||
line30 |
|
||||
mouse enabled |
|
||||
@$#^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
feed('<LeftRelease><3,2>')
|
||||
screen:expect([[
|
||||
@@ -152,7 +152,7 @@ describe(':terminal mouse', function()
|
||||
line30 |
|
||||
mouse enabled |
|
||||
#$#^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end)
|
||||
|
||||
@@ -166,7 +166,7 @@ describe(':terminal mouse', function()
|
||||
line30 |
|
||||
mouse enabled |
|
||||
`!!^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end)
|
||||
|
||||
@@ -180,7 +180,7 @@ describe(':terminal mouse', function()
|
||||
line30 |
|
||||
mouse enabled |
|
||||
"#^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
feed('<ScrollWheelUp><1,2>')
|
||||
screen:expect([[
|
||||
@@ -190,7 +190,7 @@ describe(':terminal mouse', function()
|
||||
line30 |
|
||||
mouse enabled |
|
||||
`"#^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
feed('<LeftDrag><2,2>')
|
||||
screen:expect([[
|
||||
@@ -200,7 +200,7 @@ describe(':terminal mouse', function()
|
||||
line30 |
|
||||
mouse enabled |
|
||||
@##^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
feed('<ScrollWheelUp><2,2>')
|
||||
screen:expect([[
|
||||
@@ -210,7 +210,7 @@ describe(':terminal mouse', function()
|
||||
line30 |
|
||||
mouse enabled |
|
||||
`##^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
feed('<LeftRelease><2,2>')
|
||||
screen:expect([[
|
||||
@@ -220,7 +220,7 @@ describe(':terminal mouse', function()
|
||||
line30 |
|
||||
mouse enabled |
|
||||
###^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end)
|
||||
|
||||
@@ -232,25 +232,25 @@ describe(':terminal mouse', function()
|
||||
feed('<LeftMouse><3,0>')
|
||||
eq('nt', eval('mode(1)'))
|
||||
screen:expect([[
|
||||
{7: 11 }^line28 |
|
||||
{7: 12 }line29 |
|
||||
{7: 13 }line30 |
|
||||
{7: 14 }mouse enabled |
|
||||
{7: 15 }rows: 6, cols: 46 |
|
||||
{7: 16 } |
|
||||
{121: 11 }^line28 |
|
||||
{121: 12 }line29 |
|
||||
{121: 13 }line30 |
|
||||
{121: 14 }mouse enabled |
|
||||
{121: 15 }rows: 6, cols: 46 |
|
||||
{121: 16 } |
|
||||
|
|
||||
]])
|
||||
-- If click on the coordinate (0,1) of the region of the terminal
|
||||
-- (i.e. the coordinate (4,1) of vim), 'CSI !"' is sent to the terminal.
|
||||
feed('i<LeftMouse><4,1>')
|
||||
screen:expect([[
|
||||
{7: 11 }line28 |
|
||||
{7: 12 }line29 |
|
||||
{7: 13 }line30 |
|
||||
{7: 14 }mouse enabled |
|
||||
{7: 15 }rows: 6, cols: 46 |
|
||||
{7: 16 } !"^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{121: 11 }line28 |
|
||||
{121: 12 }line29 |
|
||||
{121: 13 }line30 |
|
||||
{121: 14 }mouse enabled |
|
||||
{121: 15 }rows: 6, cols: 46 |
|
||||
{121: 16 } !"^ |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end)
|
||||
|
||||
@@ -263,7 +263,7 @@ describe(':terminal mouse', function()
|
||||
rows: 5, cols: 50 |
|
||||
^ |
|
||||
========== |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
feed('<LeftMouse><0,5>')
|
||||
screen:expect([[
|
||||
@@ -290,30 +290,30 @@ describe(':terminal mouse', function()
|
||||
command('rightbelow vnew | wincmd p | startinsert')
|
||||
screen:expect([[
|
||||
line29 │ |
|
||||
line30 │{4:~ }|
|
||||
mouse enabled │{4:~ }|
|
||||
rows: 5, cols: 24 │{4:~ }|
|
||||
^ │{4:~ }|
|
||||
line30 │{100:~ }|
|
||||
mouse enabled │{100:~ }|
|
||||
rows: 5, cols: 24 │{100:~ }|
|
||||
^ │{100:~ }|
|
||||
========== ========== |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
feed('<LeftMouse><24,0>')
|
||||
screen:expect([[
|
||||
line29 │ |
|
||||
line30 │{4:~ }|
|
||||
mouse enabled │{4:~ }|
|
||||
rows: 5, cols: 24 │{4:~ }|
|
||||
^ │{4:~ }|
|
||||
line30 │{100:~ }|
|
||||
mouse enabled │{100:~ }|
|
||||
rows: 5, cols: 24 │{100:~ }|
|
||||
^ │{100:~ }|
|
||||
========== ========== |
|
||||
|
|
||||
]])
|
||||
feed('<LeftDrag><23,0>')
|
||||
screen:expect([[
|
||||
line30 │ |
|
||||
mouse enabled │{4:~ }|
|
||||
rows: 5, cols: 24 │{4:~ }|
|
||||
rows: 5, cols: 23 │{4:~ }|
|
||||
^ │{4:~ }|
|
||||
mouse enabled │{100:~ }|
|
||||
rows: 5, cols: 24 │{100:~ }|
|
||||
rows: 5, cols: 23 │{100:~ }|
|
||||
^ │{100:~ }|
|
||||
========== ========== |
|
||||
|
|
||||
]])
|
||||
@@ -322,17 +322,17 @@ describe(':terminal mouse', function()
|
||||
it('will lose focus if winbar/tabline is clicked', function()
|
||||
command('setlocal winbar=WINBAR')
|
||||
screen:expect([[
|
||||
{3:WINBAR }|
|
||||
{5:WINBAR }|
|
||||
line29 |
|
||||
line30 |
|
||||
mouse enabled |
|
||||
rows: 5, cols: 50 |
|
||||
^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
feed('<LeftMouse><0,0>')
|
||||
screen:expect([[
|
||||
{3:WINBAR }|
|
||||
{5:WINBAR }|
|
||||
line29 |
|
||||
line30 |
|
||||
mouse enabled |
|
||||
@@ -342,18 +342,18 @@ describe(':terminal mouse', function()
|
||||
]])
|
||||
command('set showtabline=2 tabline=TABLINE | startinsert')
|
||||
screen:expect([[
|
||||
{1:TABLINE }|
|
||||
{3:WINBAR }|
|
||||
{2:TABLINE }|
|
||||
{5:WINBAR }|
|
||||
mouse enabled |
|
||||
rows: 5, cols: 50 |
|
||||
rows: 4, cols: 50 |
|
||||
^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
feed('<LeftMouse><0,0>')
|
||||
screen:expect([[
|
||||
{1:TABLINE }|
|
||||
{3:WINBAR }|
|
||||
{2:TABLINE }|
|
||||
{5:WINBAR }|
|
||||
mouse enabled |
|
||||
rows: 5, cols: 50 |
|
||||
rows: 4, cols: 50 |
|
||||
@@ -362,17 +362,17 @@ describe(':terminal mouse', function()
|
||||
]])
|
||||
command('setlocal winbar= | startinsert')
|
||||
screen:expect([[
|
||||
{1:TABLINE }|
|
||||
{2:TABLINE }|
|
||||
mouse enabled |
|
||||
rows: 5, cols: 50 |
|
||||
rows: 4, cols: 50 |
|
||||
rows: 5, cols: 50 |
|
||||
^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
feed('<LeftMouse><0,0>')
|
||||
screen:expect([[
|
||||
{1:TABLINE }|
|
||||
{2:TABLINE }|
|
||||
mouse enabled |
|
||||
rows: 5, cols: 50 |
|
||||
rows: 4, cols: 50 |
|
||||
@@ -397,80 +397,80 @@ describe(':terminal mouse', function()
|
||||
]])
|
||||
feed(':enew | set number<cr>')
|
||||
screen:expect([[
|
||||
{7: 1 }^ │line29 |
|
||||
{4:~ }│line30 |
|
||||
{4:~ }│rows: 5, cols: 25 |
|
||||
{4:~ }│rows: 5, cols: 24 |
|
||||
{4:~ }│ |
|
||||
{121: 1 }^ │line29 |
|
||||
{100:~ }│line30 |
|
||||
{100:~ }│rows: 5, cols: 25 |
|
||||
{100:~ }│rows: 5, cols: 24 |
|
||||
{100:~ }│ |
|
||||
========== ========== |
|
||||
:enew | set number |
|
||||
]])
|
||||
feed('30iline\n<esc>')
|
||||
screen:expect([[
|
||||
{7: 27 }line │line29 |
|
||||
{7: 28 }line │line30 |
|
||||
{7: 29 }line │rows: 5, cols: 25 |
|
||||
{7: 30 }line │rows: 5, cols: 24 |
|
||||
{7: 31 }^ │ |
|
||||
{121: 27 }line │line29 |
|
||||
{121: 28 }line │line30 |
|
||||
{121: 29 }line │rows: 5, cols: 25 |
|
||||
{121: 30 }line │rows: 5, cols: 24 |
|
||||
{121: 31 }^ │ |
|
||||
========== ========== |
|
||||
|
|
||||
]])
|
||||
feed('<c-w>li')
|
||||
screen:expect([[
|
||||
{7: 27 }line │line29 |
|
||||
{7: 28 }line │line30 |
|
||||
{7: 29 }line │rows: 5, cols: 25 |
|
||||
{7: 30 }line │rows: 5, cols: 24 |
|
||||
{7: 31 } │^ |
|
||||
{121: 27 }line │line29 |
|
||||
{121: 28 }line │line30 |
|
||||
{121: 29 }line │rows: 5, cols: 25 |
|
||||
{121: 30 }line │rows: 5, cols: 24 |
|
||||
{121: 31 } │^ |
|
||||
========== ========== |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
|
||||
-- enabling mouse won't affect interaction with other windows
|
||||
tt.enable_mouse()
|
||||
tt.feed_data('mouse enabled\n')
|
||||
screen:expect([[
|
||||
{7: 27 }line │line30 |
|
||||
{7: 28 }line │rows: 5, cols: 25 |
|
||||
{7: 29 }line │rows: 5, cols: 24 |
|
||||
{7: 30 }line │mouse enabled |
|
||||
{7: 31 } │^ |
|
||||
{121: 27 }line │line30 |
|
||||
{121: 28 }line │rows: 5, cols: 25 |
|
||||
{121: 29 }line │rows: 5, cols: 24 |
|
||||
{121: 30 }line │mouse enabled |
|
||||
{121: 31 } │^ |
|
||||
========== ========== |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end)
|
||||
|
||||
it("scrolling another window keeps focus and respects 'mousescroll'", function()
|
||||
feed('<ScrollWheelUp><4,0><ScrollWheelUp><4,0>')
|
||||
screen:expect([[
|
||||
{7: 21 }line │line30 |
|
||||
{7: 22 }line │rows: 5, cols: 25 |
|
||||
{7: 23 }line │rows: 5, cols: 24 |
|
||||
{7: 24 }line │mouse enabled |
|
||||
{7: 25 }line │^ |
|
||||
{121: 21 }line │line30 |
|
||||
{121: 22 }line │rows: 5, cols: 25 |
|
||||
{121: 23 }line │rows: 5, cols: 24 |
|
||||
{121: 24 }line │mouse enabled |
|
||||
{121: 25 }line │^ |
|
||||
========== ========== |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
feed('<S-ScrollWheelDown><4,0>')
|
||||
screen:expect([[
|
||||
{7: 26 }line │line30 |
|
||||
{7: 27 }line │rows: 5, cols: 25 |
|
||||
{7: 28 }line │rows: 5, cols: 24 |
|
||||
{7: 29 }line │mouse enabled |
|
||||
{7: 30 }line │^ |
|
||||
{121: 26 }line │line30 |
|
||||
{121: 27 }line │rows: 5, cols: 25 |
|
||||
{121: 28 }line │rows: 5, cols: 24 |
|
||||
{121: 29 }line │mouse enabled |
|
||||
{121: 30 }line │^ |
|
||||
========== ========== |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
command('set mousescroll=ver:10')
|
||||
feed('<ScrollWheelUp><0,0>')
|
||||
screen:expect([[
|
||||
{7: 16 }line │line30 |
|
||||
{7: 17 }line │rows: 5, cols: 25 |
|
||||
{7: 18 }line │rows: 5, cols: 24 |
|
||||
{7: 19 }line │mouse enabled |
|
||||
{7: 20 }line │^ |
|
||||
{121: 16 }line │line30 |
|
||||
{121: 17 }line │rows: 5, cols: 25 |
|
||||
{121: 18 }line │rows: 5, cols: 24 |
|
||||
{121: 19 }line │mouse enabled |
|
||||
{121: 20 }line │^ |
|
||||
========== ========== |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
command('set mousescroll=ver:0')
|
||||
feed('<ScrollWheelUp><0,0>')
|
||||
@@ -479,45 +479,45 @@ describe(':terminal mouse', function()
|
||||
command('setlocal nowrap')
|
||||
feed('0<C-V>gg3ly$4p<C-W>wi')
|
||||
screen:expect([[
|
||||
{7: 1 }linelinelinelineline │line30 |
|
||||
{7: 2 }linelinelinelineline │rows: 5, cols: 25 |
|
||||
{7: 3 }linelinelinelineline │rows: 5, cols: 24 |
|
||||
{7: 4 }linelinelinelineline │mouse enabled |
|
||||
{7: 5 }linelinelinelineline │^ |
|
||||
{121: 1 }linelinelinelineline │line30 |
|
||||
{121: 2 }linelinelinelineline │rows: 5, cols: 25 |
|
||||
{121: 3 }linelinelinelineline │rows: 5, cols: 24 |
|
||||
{121: 4 }linelinelinelineline │mouse enabled |
|
||||
{121: 5 }linelinelinelineline │^ |
|
||||
========== ========== |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
feed('<ScrollWheelRight><4,0>')
|
||||
screen:expect([[
|
||||
{7: 1 }nelinelineline │line30 |
|
||||
{7: 2 }nelinelineline │rows: 5, cols: 25 |
|
||||
{7: 3 }nelinelineline │rows: 5, cols: 24 |
|
||||
{7: 4 }nelinelineline │mouse enabled |
|
||||
{7: 5 }nelinelineline │^ |
|
||||
{121: 1 }nelinelineline │line30 |
|
||||
{121: 2 }nelinelineline │rows: 5, cols: 25 |
|
||||
{121: 3 }nelinelineline │rows: 5, cols: 24 |
|
||||
{121: 4 }nelinelineline │mouse enabled |
|
||||
{121: 5 }nelinelineline │^ |
|
||||
========== ========== |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
command('set mousescroll=hor:4')
|
||||
feed('<ScrollWheelLeft><4,0>')
|
||||
screen:expect([[
|
||||
{7: 1 }nelinelinelineline │line30 |
|
||||
{7: 2 }nelinelinelineline │rows: 5, cols: 25 |
|
||||
{7: 3 }nelinelinelineline │rows: 5, cols: 24 |
|
||||
{7: 4 }nelinelinelineline │mouse enabled |
|
||||
{7: 5 }nelinelinelineline │^ |
|
||||
{121: 1 }nelinelinelineline │line30 |
|
||||
{121: 2 }nelinelinelineline │rows: 5, cols: 25 |
|
||||
{121: 3 }nelinelinelineline │rows: 5, cols: 24 |
|
||||
{121: 4 }nelinelinelineline │mouse enabled |
|
||||
{121: 5 }nelinelinelineline │^ |
|
||||
========== ========== |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end)
|
||||
|
||||
it('will lose focus if another window is clicked', function()
|
||||
feed('<LeftMouse><5,1>')
|
||||
screen:expect([[
|
||||
{7: 27 }line │line30 |
|
||||
{7: 28 }l^ine │rows: 5, cols: 25 |
|
||||
{7: 29 }line │rows: 5, cols: 24 |
|
||||
{7: 30 }line │mouse enabled |
|
||||
{7: 31 } │ |
|
||||
{121: 27 }line │line30 |
|
||||
{121: 28 }l^ine │rows: 5, cols: 25 |
|
||||
{121: 29 }line │rows: 5, cols: 24 |
|
||||
{121: 30 }line │mouse enabled |
|
||||
{121: 31 } │ |
|
||||
========== ========== |
|
||||
|
|
||||
]])
|
||||
@@ -527,11 +527,11 @@ describe(':terminal mouse', function()
|
||||
api.nvim_set_option_value('hidden', true, {})
|
||||
feed('<c-\\><c-n><c-w><c-w>')
|
||||
screen:expect([[
|
||||
{7: 27 }line │line30 |
|
||||
{7: 28 }line │rows: 5, cols: 25 |
|
||||
{7: 29 }line │rows: 5, cols: 24 |
|
||||
{7: 30 }line │mouse enabled |
|
||||
{7: 31 }^ │ |
|
||||
{121: 27 }line │line30 |
|
||||
{121: 28 }line │rows: 5, cols: 25 |
|
||||
{121: 29 }line │rows: 5, cols: 24 |
|
||||
{121: 30 }line │mouse enabled |
|
||||
{121: 31 }^ │ |
|
||||
========== ========== |
|
||||
|
|
||||
]])
|
||||
@@ -547,11 +547,11 @@ describe(':terminal mouse', function()
|
||||
]])
|
||||
feed(':bn<cr>')
|
||||
screen:expect([[
|
||||
{7: 27 }line │rows: 5, cols: 24 |
|
||||
{7: 28 }line │mouse enabled |
|
||||
{7: 29 }line │rows: 5, cols: 25 |
|
||||
{7: 30 }line │rows: 5, cols: 24 |
|
||||
{7: 31 }^ │ |
|
||||
{121: 27 }line │rows: 5, cols: 24 |
|
||||
{121: 28 }line │mouse enabled |
|
||||
{121: 29 }line │rows: 5, cols: 25 |
|
||||
{121: 30 }line │rows: 5, cols: 24 |
|
||||
{121: 31 }^ │ |
|
||||
========== ========== |
|
||||
:bn |
|
||||
]])
|
||||
|
@@ -40,7 +40,7 @@ describe(':terminal scrollback', function()
|
||||
line29 |
|
||||
line30 |
|
||||
^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end)
|
||||
|
||||
@@ -68,7 +68,7 @@ describe(':terminal scrollback', function()
|
||||
line3 |
|
||||
line4 |
|
||||
^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end)
|
||||
|
||||
@@ -85,7 +85,7 @@ describe(':terminal scrollback', function()
|
||||
line4 |
|
||||
line5 |
|
||||
^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq(7, api.nvim_buf_line_count(0))
|
||||
end)
|
||||
@@ -103,7 +103,7 @@ describe(':terminal scrollback', function()
|
||||
line6 |
|
||||
line7 |
|
||||
line8^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
|
||||
feed('<c-\\><c-n>6k')
|
||||
@@ -203,7 +203,7 @@ describe(':terminal scrollback', function()
|
||||
rows: 4, cols: 30 |
|
||||
^ |
|
||||
|
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq(4, api.nvim_buf_line_count(0))
|
||||
end
|
||||
@@ -221,7 +221,7 @@ describe(':terminal scrollback', function()
|
||||
rows: 4, cols: 30 |
|
||||
rows: 3, cols: 30 |
|
||||
^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq(4, api.nvim_buf_line_count(0))
|
||||
feed('<c-\\><c-n>gg')
|
||||
@@ -236,7 +236,7 @@ describe(':terminal scrollback', function()
|
||||
rows: 4, cols: 30 |
|
||||
rows: 3, cols: 30 |
|
||||
^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
@@ -253,14 +253,14 @@ describe(':terminal scrollback', function()
|
||||
line3 |
|
||||
line4 |
|
||||
^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
screen:try_resize(screen._width, screen._height - 3)
|
||||
screen:expect([[
|
||||
line4 |
|
||||
rows: 3, cols: 30 |
|
||||
^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq(7, api.nvim_buf_line_count(0))
|
||||
end)
|
||||
@@ -279,7 +279,7 @@ describe(':terminal scrollback', function()
|
||||
rows: 3, cols: 30 |
|
||||
rows: 4, cols: 30 |
|
||||
^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end
|
||||
|
||||
@@ -301,7 +301,7 @@ describe(':terminal scrollback', function()
|
||||
rows: 4, cols: 30 |
|
||||
rows: 7, cols: 30 |
|
||||
^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
eq(9, api.nvim_buf_line_count(0))
|
||||
feed('<c-\\><c-n>gg')
|
||||
@@ -339,7 +339,7 @@ describe(':terminal scrollback', function()
|
||||
rows: 11, cols: 30 |
|
||||
^ |
|
||||
|
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
-- since there's an empty line after the cursor, the buffer line
|
||||
-- count equals the terminal screen height
|
||||
@@ -355,6 +355,7 @@ 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 })
|
||||
screen:add_extra_attr_ids({ [100] = { foreground = 12 } })
|
||||
command(
|
||||
("call jobstart(['%s', '10'], {'term':v:true}) | startinsert"):format(testprg('tty-test'))
|
||||
)
|
||||
@@ -369,14 +370,11 @@ describe(':terminal prints more lines than the screen height and exits', functio
|
||||
]])
|
||||
feed('<cr>')
|
||||
-- closes the buffer correctly after pressing a key
|
||||
screen:expect {
|
||||
grid = [[
|
||||
screen:expect([[
|
||||
^ |
|
||||
{1:~ }|*5
|
||||
{100:~ }|*5
|
||||
|
|
||||
]],
|
||||
attr_ids = { [1] = { foreground = 12 } },
|
||||
}
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
|
||||
@@ -449,29 +447,25 @@ describe("'scrollback' option", function()
|
||||
|
||||
feed_data(('%s REP 41 line%s'):format(testprg('shell-test'), is_os('win') and '\r' or '\n'))
|
||||
if is_os('win') then
|
||||
screen:expect {
|
||||
grid = [[
|
||||
screen:expect([[
|
||||
37: line |
|
||||
38: line |
|
||||
39: line |
|
||||
40: line |
|
||||
|
|
||||
$^ |
|
||||
{3:-- TERMINAL --} |
|
||||
]],
|
||||
}
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
else
|
||||
screen:expect {
|
||||
grid = [[
|
||||
screen:expect([[
|
||||
36: line |
|
||||
37: line |
|
||||
38: line |
|
||||
39: line |
|
||||
40: line |
|
||||
{MATCH:.*}|
|
||||
{3:-- TERMINAL --} |
|
||||
]],
|
||||
}
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end
|
||||
expect_lines(58)
|
||||
|
||||
@@ -496,7 +490,7 @@ describe("'scrollback' option", function()
|
||||
line29 |
|
||||
line30 |
|
||||
^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
local term_height = 6 -- Actual terminal screen height, not the scrollback
|
||||
-- Initial
|
||||
@@ -581,11 +575,6 @@ describe('pending scrollback line handling', function()
|
||||
before_each(function()
|
||||
clear()
|
||||
screen = Screen.new(30, 7)
|
||||
screen:set_default_attr_ids {
|
||||
[1] = { foreground = Screen.colors.Brown },
|
||||
[2] = { reverse = true },
|
||||
[3] = { bold = true },
|
||||
}
|
||||
end)
|
||||
|
||||
it("does not crash after setting 'number' #14891", function()
|
||||
@@ -598,22 +587,22 @@ describe('pending scrollback line handling', function()
|
||||
api.nvim_win_set_buf(0, buf)
|
||||
]]
|
||||
screen:expect [[
|
||||
{1: 1 }^a |
|
||||
{1: 2 }a |
|
||||
{1: 3 }a |
|
||||
{1: 4 }a |
|
||||
{1: 5 }a |
|
||||
{1: 6 }a |
|
||||
{8: 1 }^a |
|
||||
{8: 2 }a |
|
||||
{8: 3 }a |
|
||||
{8: 4 }a |
|
||||
{8: 5 }a |
|
||||
{8: 6 }a |
|
||||
|
|
||||
]]
|
||||
feed('G')
|
||||
screen:expect [[
|
||||
{1: 7 }a |
|
||||
{1: 8 }a |
|
||||
{1: 9 }a |
|
||||
{1: 10 }a |
|
||||
{1: 11 }a |
|
||||
{1: 12 }^a |
|
||||
{8: 7 }a |
|
||||
{8: 8 }a |
|
||||
{8: 9 }a |
|
||||
{8: 10 }a |
|
||||
{8: 11 }a |
|
||||
{8: 12 }^a |
|
||||
|
|
||||
]]
|
||||
assert_alive()
|
||||
@@ -637,7 +626,7 @@ describe('pending scrollback line handling', function()
|
||||
hi |*4
|
||||
|
|
||||
[Process exited 0]^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]]
|
||||
assert_alive()
|
||||
end)
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -60,46 +60,46 @@ describe(':terminal window', function()
|
||||
feed([[<C-\><C-N>]])
|
||||
feed([[:set numberwidth=1 number<CR>i]])
|
||||
screen:expect([[
|
||||
{7:1 }tty ready |
|
||||
{7:2 }rows: 6, cols: 48 |
|
||||
{7:3 }^ |
|
||||
{7:4 } |
|
||||
{7:5 } |
|
||||
{7:6 } |
|
||||
{3:-- TERMINAL --} |
|
||||
{121:1 }tty ready |
|
||||
{121:2 }rows: 6, cols: 48 |
|
||||
{121:3 }^ |
|
||||
{121:4 } |
|
||||
{121:5 } |
|
||||
{121:6 } |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
feed_data('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
|
||||
screen:expect([[
|
||||
{7:1 }tty ready |
|
||||
{7:2 }rows: 6, cols: 48 |
|
||||
{7:3 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV|
|
||||
{7:4 }WXYZ^ |
|
||||
{7:5 } |
|
||||
{7:6 } |
|
||||
{3:-- TERMINAL --} |
|
||||
{121:1 }tty ready |
|
||||
{121:2 }rows: 6, cols: 48 |
|
||||
{121:3 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV|
|
||||
{121:4 }WXYZ^ |
|
||||
{121:5 } |
|
||||
{121:6 } |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
|
||||
-- numberwidth=9
|
||||
feed([[<C-\><C-N>]])
|
||||
feed([[:set numberwidth=9 number<CR>i]])
|
||||
screen:expect([[
|
||||
{7: 1 }tty ready |
|
||||
{7: 2 }rows: 6, cols: 48 |
|
||||
{7: 3 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNO|
|
||||
{7: 4 }PQRSTUVWXYZrows: 6, cols: 41 |
|
||||
{7: 5 }^ |
|
||||
{7: 6 } |
|
||||
{3:-- TERMINAL --} |
|
||||
{121: 1 }tty ready |
|
||||
{121: 2 }rows: 6, cols: 48 |
|
||||
{121: 3 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNO|
|
||||
{121: 4 }PQRSTUVWXYZrows: 6, cols: 41 |
|
||||
{121: 5 }^ |
|
||||
{121: 6 } |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
feed_data(' abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
|
||||
screen:expect([[
|
||||
{7: 1 }tty ready |
|
||||
{7: 2 }rows: 6, cols: 48 |
|
||||
{7: 3 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNO|
|
||||
{7: 4 }PQRSTUVWXYZrows: 6, cols: 41 |
|
||||
{7: 5 } abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMN|
|
||||
{7: 6 }OPQRSTUVWXYZ^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{121: 1 }tty ready |
|
||||
{121: 2 }rows: 6, cols: 48 |
|
||||
{121: 3 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNO|
|
||||
{121: 4 }PQRSTUVWXYZrows: 6, cols: 41 |
|
||||
{121: 5 } abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMN|
|
||||
{121: 6 }OPQRSTUVWXYZ^ |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
@@ -108,33 +108,33 @@ describe(':terminal window', function()
|
||||
it('wraps text', function()
|
||||
command([[set number statuscolumn=++%l\ \ ]])
|
||||
screen:expect([[
|
||||
{7:++1 }tty ready |
|
||||
{7:++2 }rows: 6, cols: 45 |
|
||||
{7:++3 }^ |
|
||||
{7:++4 } |
|
||||
{7:++5 } |
|
||||
{7:++6 } |
|
||||
{3:-- TERMINAL --} |
|
||||
{121:++1 }tty ready |
|
||||
{121:++2 }rows: 6, cols: 45 |
|
||||
{121:++3 }^ |
|
||||
{121:++4 } |
|
||||
{121:++5 } |
|
||||
{121:++6 } |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
feed_data('\n\n\n\n\nabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
|
||||
screen:expect([[
|
||||
{7:++4 } |
|
||||
{7:++5 } |
|
||||
{7:++6 } |
|
||||
{7:++7 } |
|
||||
{7:++8 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRS|
|
||||
{7:++9 }TUVWXYZ^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{121:++4 } |
|
||||
{121:++5 } |
|
||||
{121:++6 } |
|
||||
{121:++7 } |
|
||||
{121:++8 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRS|
|
||||
{121:++9 }TUVWXYZ^ |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
feed_data('\nabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
|
||||
screen:expect([[
|
||||
{7:++ 7 } |
|
||||
{7:++ 8 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQR|
|
||||
{7:++ 9 }STUVWXYZ |
|
||||
{7:++10 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQR|
|
||||
{7:++11 }STUVWXYZrows: 6, cols: 44 |
|
||||
{7:++12 }^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{121:++ 7 } |
|
||||
{121:++ 8 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQR|
|
||||
{121:++ 9 }STUVWXYZ |
|
||||
{121:++10 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQR|
|
||||
{121:++11 }STUVWXYZrows: 6, cols: 44 |
|
||||
{121:++12 }^ |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
@@ -155,7 +155,7 @@ describe(':terminal window', function()
|
||||
tty ready |
|
||||
^ |
|
||||
|*4
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
@@ -171,7 +171,7 @@ describe(':terminal window', function()
|
||||
line3 |
|
||||
line4 |
|
||||
^ |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end)
|
||||
|
||||
@@ -209,7 +209,7 @@ describe(':terminal with multigrid', function()
|
||||
^ |
|
||||
|*4
|
||||
## grid 3
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
|
||||
screen:try_resize_grid(2, 20, 10)
|
||||
@@ -226,7 +226,7 @@ describe(':terminal with multigrid', function()
|
||||
^ |
|
||||
|*7
|
||||
## grid 3
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end
|
||||
|
||||
@@ -243,7 +243,7 @@ describe(':terminal with multigrid', function()
|
||||
rows: 3, cols: 70 |
|
||||
^ |
|
||||
## grid 3
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end
|
||||
|
||||
@@ -263,7 +263,7 @@ describe(':terminal with multigrid', function()
|
||||
^ |
|
||||
|
|
||||
## grid 3
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end
|
||||
end)
|
||||
|
@@ -119,25 +119,31 @@ function M.setup_screen(extra_rows, cmd, cols, env, screen_opts)
|
||||
api.nvim_command('highlight StatusLineTermNC ctermbg=2 ctermfg=8')
|
||||
|
||||
local screen = Screen.new(cols, 7 + extra_rows, screen_opts or { rgb = false })
|
||||
screen:set_default_attr_ids({
|
||||
[1] = { reverse = true }, -- focused cursor
|
||||
[2] = { background = 11 }, -- unfocused cursor
|
||||
[3] = { bold = true },
|
||||
[4] = { foreground = 12 }, -- NonText in :terminal session
|
||||
[5] = { bold = true, reverse = true },
|
||||
[6] = { foreground = 81 }, -- SpecialKey in :terminal session
|
||||
[7] = { foreground = 130 }, -- LineNr in host session
|
||||
[8] = { foreground = 15, background = 1 }, -- ErrorMsg in :terminal session
|
||||
[9] = { foreground = 4 },
|
||||
[10] = { foreground = 121 }, -- MoreMsg in :terminal session
|
||||
[11] = { foreground = 11 }, -- LineNr in :terminal session
|
||||
[12] = { underline = true },
|
||||
[13] = { underline = true, reverse = true },
|
||||
[14] = { underline = true, reverse = true, bold = true },
|
||||
[15] = { underline = true, foreground = 12 },
|
||||
[16] = { background = 248, foreground = 0 }, -- Visual in :terminal session
|
||||
[17] = { background = 2, foreground = 0 }, -- StatusLineTerm
|
||||
[18] = { background = 2, foreground = 8 }, -- StatusLineTermNC
|
||||
screen:add_extra_attr_ids({
|
||||
[100] = { foreground = 12 },
|
||||
[101] = { foreground = 15, background = 1 },
|
||||
[102] = { foreground = 121 },
|
||||
[103] = { foreground = 11 },
|
||||
[104] = { foreground = 81 },
|
||||
[105] = { underline = true, reverse = true },
|
||||
[106] = { underline = true, reverse = true, bold = true },
|
||||
[107] = { underline = true },
|
||||
[108] = { background = 248, foreground = Screen.colors.Black },
|
||||
[109] = { bold = true, background = 121, foreground = Screen.colors.Grey0 },
|
||||
[110] = { fg_indexed = true, foreground = tonumber('0xe0e000') },
|
||||
[111] = { fg_indexed = true, foreground = tonumber('0x4040ff') },
|
||||
[112] = { foreground = 4 },
|
||||
[113] = { foreground = Screen.colors.SeaGreen4 },
|
||||
[114] = { undercurl = true },
|
||||
[115] = { underdouble = true },
|
||||
[116] = { underline = true, foreground = 12 },
|
||||
[117] = { background = 1 },
|
||||
[118] = { background = 1, reverse = true },
|
||||
[119] = { background = 2, foreground = 8 },
|
||||
[120] = { foreground = Screen.colors.Black, background = 2 },
|
||||
[121] = { foreground = 130 },
|
||||
[122] = { background = 46 },
|
||||
[123] = { foreground = 2 },
|
||||
})
|
||||
|
||||
api.nvim_command('enew')
|
||||
@@ -170,7 +176,7 @@ function M.setup_screen(extra_rows, cmd, cols, env, screen_opts)
|
||||
table.insert(expected, empty_line)
|
||||
end
|
||||
|
||||
table.insert(expected, '{3:-- TERMINAL --}' .. ((' '):rep(cols - 14)))
|
||||
table.insert(expected, '{5:-- TERMINAL --}' .. ((' '):rep(cols - 14)))
|
||||
screen:expect(table.concat(expected, '|\n') .. '|')
|
||||
else
|
||||
-- This eval also acts as a poke_eventloop().
|
||||
|
@@ -35,9 +35,9 @@ describe('shell command :!', function()
|
||||
})
|
||||
screen:expect([[
|
||||
^ |
|
||||
{4:~ }|*4
|
||||
{100:~ }|*4
|
||||
|
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end)
|
||||
|
||||
@@ -52,11 +52,11 @@ describe('shell command :!', function()
|
||||
tt.feed_data(':!printf foo; sleep 200\n')
|
||||
screen:expect([[
|
||||
|
|
||||
{4:~ }|*2
|
||||
{5: }|
|
||||
{100:~ }|*2
|
||||
{3: }|
|
||||
:!printf foo; sleep 200 |
|
||||
foo |
|
||||
{3:-- TERMINAL --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end)
|
||||
|
||||
@@ -71,23 +71,15 @@ describe('shell command :!', function()
|
||||
|
||||
-- Final chunk of output should always be displayed, never skipped.
|
||||
-- (Throttling is non-deterministic, this test is merely a sanity check.)
|
||||
screen:expect(
|
||||
[[
|
||||
screen:expect([[
|
||||
29997: foo |
|
||||
29998: foo |
|
||||
29999: foo |
|
||||
30000: foo |
|
||||
|
|
||||
{10:Press ENTER or type command to continue}^ |
|
||||
{3:-- TERMINAL --} |
|
||||
]],
|
||||
{
|
||||
-- test/functional/testnvim.lua defaults to background=light.
|
||||
[1] = { reverse = true },
|
||||
[3] = { bold = true },
|
||||
[10] = { foreground = 2 },
|
||||
}
|
||||
)
|
||||
{123:Press ENTER or type command to continue}^ |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
|
||||
@@ -111,14 +103,12 @@ describe('shell command :!', function()
|
||||
local screen = Screen.new(50, 4)
|
||||
-- Print TAB chars. #2958
|
||||
feed([[:!printf '1\t2\t3'<CR>]])
|
||||
screen:expect {
|
||||
grid = [[
|
||||
screen:expect([[
|
||||
{3: }|
|
||||
:!printf '1\t2\t3' |
|
||||
1 2 3 |
|
||||
{6:Press ENTER or type command to continue}^ |
|
||||
]],
|
||||
}
|
||||
]])
|
||||
feed([[<CR>]])
|
||||
|
||||
-- Print BELL control code. #4338
|
||||
@@ -126,11 +116,11 @@ describe('shell command :!', function()
|
||||
feed([[:!printf '\007\007\007\007text'<CR>]])
|
||||
screen:expect {
|
||||
grid = [[
|
||||
{3: }|
|
||||
:!printf '\007\007\007\007text' |
|
||||
text |
|
||||
{6:Press ENTER or type command to continue}^ |
|
||||
]],
|
||||
{3: }|
|
||||
:!printf '\007\007\007\007text' |
|
||||
text |
|
||||
{6:Press ENTER or type command to continue}^ |
|
||||
]],
|
||||
condition = function()
|
||||
eq(true, screen.bell)
|
||||
end,
|
||||
@@ -199,17 +189,17 @@ describe('shell command :!', function()
|
||||
screen.bell = false
|
||||
screen:expect {
|
||||
grid = [[
|
||||
|
|
||||
{1:~ }|
|
||||
{3: }|
|
||||
:!cat test/functional/fixtures/shell_data.txt |
|
||||
^@^A^B^C^D^E^F^H |
|
||||
^N^O^P^Q^R^S^T^U^V^W^X^Y^Z^[^\^]^^^_ |
|
||||
ö 한글 <a5><c3> |
|
||||
t <ff> |
|
||||
|
|
||||
{6:Press ENTER or type command to continue}^ |
|
||||
]],
|
||||
|
|
||||
{1:~ }|
|
||||
{3: }|
|
||||
:!cat test/functional/fixtures/shell_data.txt |
|
||||
^@^A^B^C^D^E^F^H |
|
||||
^N^O^P^Q^R^S^T^U^V^W^X^Y^Z^[^\^]^^^_ |
|
||||
ö 한글 <a5><c3> |
|
||||
t <ff> |
|
||||
|
|
||||
{6:Press ENTER or type command to continue}^ |
|
||||
]],
|
||||
condition = function()
|
||||
eq(true, screen.bell)
|
||||
end,
|
||||
|
Reference in New Issue
Block a user