mirror of
https://github.com/neovim/neovim.git
synced 2025-12-16 03:15:39 +00:00
test: rename (meths, funcs) -> (api, fn)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
local helpers = require('test.functional.helpers')(after_each)
|
||||
local thelpers = require('test.functional.terminal.helpers')
|
||||
local clear, eq, meths = helpers.clear, helpers.eq, helpers.meths
|
||||
local clear, eq, api = helpers.clear, helpers.eq, helpers.api
|
||||
local feed = helpers.feed
|
||||
local feed_data = thelpers.feed_data
|
||||
local enter_altscreen = thelpers.enter_altscreen
|
||||
@@ -42,7 +42,7 @@ describe(':terminal altscreen', function()
|
||||
{1: } |
|
||||
{3:-- TERMINAL --} |
|
||||
]])
|
||||
eq(10, meths.nvim_buf_line_count(0))
|
||||
eq(10, api.nvim_buf_line_count(0))
|
||||
end)
|
||||
|
||||
it('wont clear lines already in the scrollback', function()
|
||||
@@ -107,7 +107,7 @@ describe(':terminal altscreen', function()
|
||||
end)
|
||||
|
||||
it('wont modify line count', function()
|
||||
eq(10, meths.nvim_buf_line_count(0))
|
||||
eq(10, api.nvim_buf_line_count(0))
|
||||
end)
|
||||
|
||||
it('wont modify lines in the scrollback', function()
|
||||
@@ -144,7 +144,7 @@ describe(':terminal altscreen', function()
|
||||
rows: 4, cols: 50 |
|
||||
|
|
||||
]])
|
||||
eq(9, meths.nvim_buf_line_count(0))
|
||||
eq(9, api.nvim_buf_line_count(0))
|
||||
end)
|
||||
|
||||
describe('and after exit', function()
|
||||
|
||||
@@ -8,7 +8,7 @@ local nvim_prog = helpers.nvim_prog
|
||||
local eval, feed_command, source = helpers.eval, helpers.feed_command, helpers.source
|
||||
local pcall_err = helpers.pcall_err
|
||||
local eq, neq = helpers.eq, helpers.neq
|
||||
local meths = helpers.meths
|
||||
local api = helpers.api
|
||||
local retry = helpers.retry
|
||||
local write_file = helpers.write_file
|
||||
local command = helpers.command
|
||||
@@ -16,7 +16,7 @@ local exc_exec = helpers.exc_exec
|
||||
local matches = helpers.matches
|
||||
local exec_lua = helpers.exec_lua
|
||||
local sleep = vim.uv.sleep
|
||||
local funcs = helpers.funcs
|
||||
local fn = helpers.fn
|
||||
local is_os = helpers.is_os
|
||||
local skip = helpers.skip
|
||||
|
||||
@@ -92,12 +92,12 @@ describe(':terminal buffer', function()
|
||||
end)
|
||||
|
||||
it('does not create swap files', function()
|
||||
local swapfile = meths.nvim_exec('swapname', true):gsub('\n', '')
|
||||
local swapfile = api.nvim_exec('swapname', true):gsub('\n', '')
|
||||
eq(nil, io.open(swapfile))
|
||||
end)
|
||||
|
||||
it('does not create undofiles files', function()
|
||||
local undofile = meths.nvim_eval('undofile(bufname("%"))')
|
||||
local undofile = api.nvim_eval('undofile(bufname("%"))')
|
||||
eq(nil, io.open(undofile))
|
||||
end)
|
||||
end)
|
||||
@@ -172,7 +172,7 @@ describe(':terminal buffer', function()
|
||||
|
||||
it('handles loss of focus gracefully', function()
|
||||
-- Change the statusline to avoid printing the file name, which varies.
|
||||
meths.nvim_set_option_value('statusline', '==========', {})
|
||||
api.nvim_set_option_value('statusline', '==========', {})
|
||||
|
||||
-- Save the buffer number of the terminal for later testing.
|
||||
local tbuf = eval('bufnr("%")')
|
||||
@@ -277,7 +277,7 @@ describe(':terminal buffer', function()
|
||||
end)
|
||||
|
||||
it([[can use temporary normal mode <c-\><c-o>]], function()
|
||||
eq('t', funcs.mode(1))
|
||||
eq('t', fn.mode(1))
|
||||
feed [[<c-\><c-o>]]
|
||||
screen:expect {
|
||||
grid = [[
|
||||
@@ -287,7 +287,7 @@ describe(':terminal buffer', function()
|
||||
{3:-- (terminal) --} |
|
||||
]],
|
||||
}
|
||||
eq('ntT', funcs.mode(1))
|
||||
eq('ntT', fn.mode(1))
|
||||
|
||||
feed [[:let g:x = 17]]
|
||||
screen:expect {
|
||||
@@ -308,7 +308,7 @@ describe(':terminal buffer', function()
|
||||
{3:-- TERMINAL --} |
|
||||
]],
|
||||
}
|
||||
eq('t', funcs.mode(1))
|
||||
eq('t', fn.mode(1))
|
||||
end)
|
||||
|
||||
it('writing to an existing file with :w fails #13549', function()
|
||||
@@ -321,18 +321,18 @@ describe(':terminal buffer', function()
|
||||
it('emits TermRequest events #26972', function()
|
||||
command('split')
|
||||
command('enew')
|
||||
local term = meths.nvim_open_term(0, {})
|
||||
local termbuf = meths.nvim_get_current_buf().id
|
||||
local term = api.nvim_open_term(0, {})
|
||||
local termbuf = api.nvim_get_current_buf().id
|
||||
|
||||
-- Test that autocommand buffer is associated with the terminal buffer, not the current buffer
|
||||
command('au TermRequest * let g:termbuf = +expand("<abuf>")')
|
||||
command('wincmd p')
|
||||
|
||||
-- cwd will be inserted in a file URI, which cannot contain backs
|
||||
local cwd = funcs.getcwd():gsub('\\', '/')
|
||||
local cwd = fn.getcwd():gsub('\\', '/')
|
||||
local parent = cwd:match('^(.+/)')
|
||||
local expected = '\027]7;file://host' .. parent
|
||||
meths.nvim_chan_send(term, string.format('%s\027\\', expected))
|
||||
api.nvim_chan_send(term, string.format('%s\027\\', expected))
|
||||
eq(expected, eval('v:termrequest'))
|
||||
eq(termbuf, eval('g:termbuf'))
|
||||
end)
|
||||
@@ -405,11 +405,11 @@ end)
|
||||
|
||||
it('terminal truncates number of composing characters to 5', function()
|
||||
clear()
|
||||
local chan = meths.nvim_open_term(0, {})
|
||||
local chan = api.nvim_open_term(0, {})
|
||||
local composing = ('a̳'):sub(2)
|
||||
meths.nvim_chan_send(chan, 'a' .. composing:rep(8))
|
||||
api.nvim_chan_send(chan, 'a' .. composing:rep(8))
|
||||
retry(nil, nil, function()
|
||||
eq('a' .. composing:rep(5), meths.nvim_get_current_line())
|
||||
eq('a' .. composing:rep(5), api.nvim_get_current_line())
|
||||
end)
|
||||
end)
|
||||
|
||||
@@ -512,7 +512,7 @@ describe('terminal input', function()
|
||||
}) do
|
||||
feed('<CR><C-V>' .. key)
|
||||
retry(nil, nil, function()
|
||||
eq(key, meths.nvim_get_current_line())
|
||||
eq(key, api.nvim_get_current_line())
|
||||
end)
|
||||
end
|
||||
end)
|
||||
@@ -599,7 +599,7 @@ describe('termopen()', function()
|
||||
feed('q:')
|
||||
eq(
|
||||
'Vim:E11: Invalid in command-line window; <CR> executes, CTRL-C quits',
|
||||
pcall_err(funcs.termopen, 'bar')
|
||||
pcall_err(fn.termopen, 'bar')
|
||||
)
|
||||
end)
|
||||
|
||||
@@ -610,13 +610,13 @@ describe('termopen()', function()
|
||||
|
||||
before_each(function()
|
||||
-- Outer value should never be propagated to :terminal
|
||||
funcs.setenv('COLORTERM', 'wrongvalue')
|
||||
fn.setenv('COLORTERM', 'wrongvalue')
|
||||
end)
|
||||
|
||||
local function test_term_colorterm(expected, opts)
|
||||
local screen = Screen.new(50, 4)
|
||||
screen:attach()
|
||||
funcs.termopen({
|
||||
fn.termopen({
|
||||
nvim_prog,
|
||||
'-u',
|
||||
'NONE',
|
||||
|
||||
@@ -8,7 +8,7 @@ local pcall_err = helpers.pcall_err
|
||||
local feed = helpers.feed
|
||||
local poke_eventloop = helpers.poke_eventloop
|
||||
local is_os = helpers.is_os
|
||||
local meths = helpers.meths
|
||||
local api = helpers.api
|
||||
local async_meths = helpers.async_meths
|
||||
local testprg = helpers.testprg
|
||||
local assert_alive = helpers.assert_alive
|
||||
@@ -140,7 +140,7 @@ describe('no crash when TermOpen autocommand', function()
|
||||
|
||||
before_each(function()
|
||||
clear()
|
||||
meths.nvim_set_option_value('shell', testprg('shell-test'), {})
|
||||
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({
|
||||
@@ -232,11 +232,11 @@ describe('nvim_open_term', function()
|
||||
end)
|
||||
|
||||
it('with force_crlf=true converts newlines', function()
|
||||
local win = meths.nvim_get_current_win()
|
||||
local buf = meths.nvim_create_buf(false, true)
|
||||
local term = meths.nvim_open_term(buf, { force_crlf = true })
|
||||
meths.nvim_win_set_buf(win, buf)
|
||||
meths.nvim_chan_send(term, 'here\nthere\nfoo\r\nbar\n\ntest')
|
||||
local win = api.nvim_get_current_win()
|
||||
local buf = api.nvim_create_buf(false, true)
|
||||
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 = [[
|
||||
^here |
|
||||
@@ -248,7 +248,7 @@ describe('nvim_open_term', function()
|
||||
|*4
|
||||
]],
|
||||
}
|
||||
meths.nvim_chan_send(term, '\nfirst')
|
||||
api.nvim_chan_send(term, '\nfirst')
|
||||
screen:expect {
|
||||
grid = [[
|
||||
^here |
|
||||
@@ -264,11 +264,11 @@ describe('nvim_open_term', function()
|
||||
end)
|
||||
|
||||
it('with force_crlf=false does not convert newlines', function()
|
||||
local win = meths.nvim_get_current_win()
|
||||
local buf = meths.nvim_create_buf(false, true)
|
||||
local term = meths.nvim_open_term(buf, { force_crlf = false })
|
||||
meths.nvim_win_set_buf(win, buf)
|
||||
meths.nvim_chan_send(term, 'here\nthere')
|
||||
local win = api.nvim_get_current_win()
|
||||
local buf = api.nvim_create_buf(false, true)
|
||||
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 = [[
|
||||
^here |
|
||||
there |
|
||||
|
||||
@@ -3,8 +3,8 @@ local screen = require('test.functional.ui.screen')
|
||||
|
||||
local testprg = helpers.testprg
|
||||
local command = helpers.command
|
||||
local funcs = helpers.funcs
|
||||
local meths = helpers.meths
|
||||
local fn = helpers.fn
|
||||
local api = helpers.api
|
||||
local clear = helpers.clear
|
||||
local eq = helpers.eq
|
||||
local matches = helpers.matches
|
||||
@@ -19,17 +19,17 @@ describe(':edit term://*', function()
|
||||
|
||||
before_each(function()
|
||||
clear()
|
||||
meths.nvim_set_option_value('shell', testprg('shell-test'), {})
|
||||
meths.nvim_set_option_value('shellcmdflag', 'EXE', {})
|
||||
api.nvim_set_option_value('shell', testprg('shell-test'), {})
|
||||
api.nvim_set_option_value('shellcmdflag', 'EXE', {})
|
||||
end)
|
||||
|
||||
it('runs TermOpen event', function()
|
||||
meths.nvim_set_var('termopen_runs', {})
|
||||
api.nvim_set_var('termopen_runs', {})
|
||||
command('autocmd TermOpen * :call add(g:termopen_runs, expand("<amatch>"))')
|
||||
command('edit term://')
|
||||
local termopen_runs = meths.nvim_get_var('termopen_runs')
|
||||
local termopen_runs = api.nvim_get_var('termopen_runs')
|
||||
eq(1, #termopen_runs)
|
||||
local cwd = funcs.fnamemodify('.', ':p:~'):gsub([[[\/]*$]], '')
|
||||
local cwd = fn.fnamemodify('.', ':p:~'):gsub([[[\/]*$]], '')
|
||||
matches('^term://' .. pesc(cwd) .. '//%d+:$', termopen_runs[1])
|
||||
end)
|
||||
|
||||
@@ -37,7 +37,7 @@ describe(':edit term://*', function()
|
||||
local columns, lines = 20, 4
|
||||
local scr = get_screen(columns, lines)
|
||||
local rep = 97
|
||||
meths.nvim_set_option_value('shellcmdflag', 'REP ' .. rep, {})
|
||||
api.nvim_set_option_value('shellcmdflag', 'REP ' .. rep, {})
|
||||
command('set shellxquote=') -- win: avoid extra quotes
|
||||
local sb = 10
|
||||
command(
|
||||
@@ -46,7 +46,7 @@ describe(':edit term://*', function()
|
||||
command('edit term://foobar')
|
||||
|
||||
local bufcontents = {}
|
||||
local winheight = meths.nvim_win_get_height(0)
|
||||
local winheight = api.nvim_win_get_height(0)
|
||||
local buf_cont_start = rep - sb - winheight + 2
|
||||
for i = buf_cont_start, (rep - 1) do
|
||||
bufcontents[#bufcontents + 1] = ('%d: foobar'):format(i)
|
||||
@@ -63,6 +63,6 @@ describe(':edit term://*', function()
|
||||
|
||||
exp_screen = exp_screen .. (' '):rep(columns) .. '|\n'
|
||||
scr:expect(exp_screen)
|
||||
eq(bufcontents, meths.nvim_buf_get_lines(0, 0, -1, true))
|
||||
eq(bufcontents, api.nvim_buf_get_lines(0, 0, -1, true))
|
||||
end)
|
||||
end)
|
||||
|
||||
@@ -5,8 +5,8 @@ local clear, poke_eventloop = helpers.clear, helpers.poke_eventloop
|
||||
local testprg, source, eq = helpers.testprg, helpers.source, helpers.eq
|
||||
local feed = helpers.feed
|
||||
local feed_command, eval = helpers.feed_command, helpers.eval
|
||||
local funcs = helpers.funcs
|
||||
local meths = helpers.meths
|
||||
local fn = helpers.fn
|
||||
local api = helpers.api
|
||||
local retry = helpers.retry
|
||||
local ok = helpers.ok
|
||||
local command = helpers.command
|
||||
@@ -36,7 +36,7 @@ describe(':terminal', function()
|
||||
poke_eventloop()
|
||||
-- Wait for some terminal activity.
|
||||
retry(nil, 4000, function()
|
||||
ok(funcs.line('$') > 6)
|
||||
ok(fn.line('$') > 6)
|
||||
end)
|
||||
feed_command('messages')
|
||||
screen:expect([[
|
||||
@@ -80,7 +80,7 @@ describe(':terminal', function()
|
||||
it('Enter/Leave does not increment jumplist #3723', function()
|
||||
feed_command('terminal')
|
||||
local function enter_and_leave()
|
||||
local lines_before = funcs.line('$')
|
||||
local lines_before = fn.line('$')
|
||||
-- Create a new line (in the shell). For a normal buffer this
|
||||
-- increments the jumplist; for a terminal-buffer it should not. #3723
|
||||
feed('i')
|
||||
@@ -91,44 +91,44 @@ describe(':terminal', function()
|
||||
poke_eventloop()
|
||||
-- Wait for >=1 lines to be created.
|
||||
retry(nil, 4000, function()
|
||||
ok(funcs.line('$') > lines_before)
|
||||
ok(fn.line('$') > lines_before)
|
||||
end)
|
||||
end
|
||||
enter_and_leave()
|
||||
enter_and_leave()
|
||||
enter_and_leave()
|
||||
ok(funcs.line('$') > 6) -- Verify assumption.
|
||||
local jumps = funcs.split(funcs.execute('jumps'), '\n')
|
||||
ok(fn.line('$') > 6) -- Verify assumption.
|
||||
local jumps = fn.split(fn.execute('jumps'), '\n')
|
||||
eq(' jump line col file/text', jumps[1])
|
||||
eq(3, #jumps)
|
||||
end)
|
||||
|
||||
it('nvim_get_mode() in :terminal', function()
|
||||
command('terminal')
|
||||
eq({ blocking = false, mode = 'nt' }, meths.nvim_get_mode())
|
||||
eq({ blocking = false, mode = 'nt' }, api.nvim_get_mode())
|
||||
feed('i')
|
||||
eq({ blocking = false, mode = 't' }, meths.nvim_get_mode())
|
||||
eq({ blocking = false, mode = 't' }, api.nvim_get_mode())
|
||||
feed([[<C-\><C-N>]])
|
||||
eq({ blocking = false, mode = 'nt' }, meths.nvim_get_mode())
|
||||
eq({ blocking = false, mode = 'nt' }, api.nvim_get_mode())
|
||||
end)
|
||||
|
||||
it(':stopinsert RPC request exits terminal-mode #7807', function()
|
||||
command('terminal')
|
||||
feed('i[tui] insert-mode')
|
||||
eq({ blocking = false, mode = 't' }, meths.nvim_get_mode())
|
||||
eq({ blocking = false, mode = 't' }, api.nvim_get_mode())
|
||||
command('stopinsert')
|
||||
feed('<Ignore>') -- Add input to separate two RPC requests
|
||||
eq({ blocking = false, mode = 'nt' }, meths.nvim_get_mode())
|
||||
eq({ blocking = false, mode = 'nt' }, api.nvim_get_mode())
|
||||
end)
|
||||
|
||||
it(":stopinsert in normal mode doesn't break insert mode #9889", function()
|
||||
command('terminal')
|
||||
eq({ blocking = false, mode = 'nt' }, meths.nvim_get_mode())
|
||||
eq({ blocking = false, mode = 'nt' }, api.nvim_get_mode())
|
||||
command('stopinsert')
|
||||
feed('<Ignore>') -- Add input to separate two RPC requests
|
||||
eq({ blocking = false, mode = 'nt' }, meths.nvim_get_mode())
|
||||
eq({ blocking = false, mode = 'nt' }, api.nvim_get_mode())
|
||||
feed('a')
|
||||
eq({ blocking = false, mode = 't' }, meths.nvim_get_mode())
|
||||
eq({ blocking = false, mode = 't' }, api.nvim_get_mode())
|
||||
end)
|
||||
|
||||
it('switching to terminal buffer in Insert mode goes to Terminal mode #7164', function()
|
||||
@@ -139,9 +139,9 @@ describe(':terminal', function()
|
||||
command('autocmd InsertLeave * let g:events += ["InsertLeave"]')
|
||||
command('autocmd TermEnter * let g:events += ["TermEnter"]')
|
||||
command('inoremap <F2> <Cmd>wincmd p<CR>')
|
||||
eq({ blocking = false, mode = 'i' }, meths.nvim_get_mode())
|
||||
eq({ blocking = false, mode = 'i' }, api.nvim_get_mode())
|
||||
feed('<F2>')
|
||||
eq({ blocking = false, mode = 't' }, meths.nvim_get_mode())
|
||||
eq({ blocking = false, mode = 't' }, api.nvim_get_mode())
|
||||
eq({ 'InsertLeave', 'TermEnter' }, eval('g:events'))
|
||||
end)
|
||||
end)
|
||||
@@ -159,9 +159,9 @@ local function test_terminal_with_fake_shell(backslash)
|
||||
clear()
|
||||
screen = Screen.new(50, 4)
|
||||
screen:attach({ rgb = false })
|
||||
meths.nvim_set_option_value('shell', shell_path, {})
|
||||
meths.nvim_set_option_value('shellcmdflag', 'EXE', {})
|
||||
meths.nvim_set_option_value('shellxquote', '', {})
|
||||
api.nvim_set_option_value('shell', shell_path, {})
|
||||
api.nvim_set_option_value('shellcmdflag', 'EXE', {})
|
||||
api.nvim_set_option_value('shellxquote', '', {})
|
||||
end)
|
||||
|
||||
it('with no argument, acts like termopen()', function()
|
||||
@@ -178,7 +178,7 @@ local function test_terminal_with_fake_shell(backslash)
|
||||
end)
|
||||
|
||||
it("with no argument, and 'shell' is set to empty string", function()
|
||||
meths.nvim_set_option_value('shell', '', {})
|
||||
api.nvim_set_option_value('shell', '', {})
|
||||
feed_command('terminal')
|
||||
screen:expect([[
|
||||
^ |
|
||||
@@ -188,7 +188,7 @@ local function test_terminal_with_fake_shell(backslash)
|
||||
end)
|
||||
|
||||
it("with no argument, but 'shell' has arguments, acts like termopen()", function()
|
||||
meths.nvim_set_option_value('shell', shell_path .. ' INTERACT', {})
|
||||
api.nvim_set_option_value('shell', shell_path .. ' INTERACT', {})
|
||||
feed_command('terminal')
|
||||
screen:expect([[
|
||||
^interact $ |
|
||||
@@ -209,7 +209,7 @@ local function test_terminal_with_fake_shell(backslash)
|
||||
end)
|
||||
|
||||
it("executes a given command through the shell, when 'shell' has arguments", function()
|
||||
meths.nvim_set_option_value('shell', shell_path .. ' -t jeff', {})
|
||||
api.nvim_set_option_value('shell', shell_path .. ' -t jeff', {})
|
||||
command('set shellxquote=') -- win: avoid extra quotes
|
||||
feed_command('terminal echo hi')
|
||||
screen:expect([[
|
||||
|
||||
@@ -5,7 +5,7 @@ local helpers = require('test.functional.helpers')(nil)
|
||||
local Screen = require('test.functional.ui.screen')
|
||||
local testprg = helpers.testprg
|
||||
local exec_lua = helpers.exec_lua
|
||||
local meths = helpers.meths
|
||||
local api = helpers.api
|
||||
local nvim_prog = helpers.nvim_prog
|
||||
|
||||
local function feed_data(data)
|
||||
@@ -89,8 +89,8 @@ local function screen_setup(extra_rows, command, cols, env, screen_opts)
|
||||
command = command and command or default_command
|
||||
cols = cols and cols or 50
|
||||
|
||||
meths.nvim_command('highlight TermCursor cterm=reverse')
|
||||
meths.nvim_command('highlight TermCursorNC ctermbg=11')
|
||||
api.nvim_command('highlight TermCursor cterm=reverse')
|
||||
api.nvim_command('highlight TermCursorNC ctermbg=11')
|
||||
|
||||
local screen = Screen.new(cols, 7 + extra_rows)
|
||||
screen:set_default_attr_ids({
|
||||
@@ -113,17 +113,17 @@ local function screen_setup(extra_rows, command, cols, env, screen_opts)
|
||||
|
||||
screen:attach(screen_opts or { rgb = false })
|
||||
|
||||
meths.nvim_command('enew')
|
||||
meths.nvim_call_function('termopen', { command, env and { env = env } or nil })
|
||||
meths.nvim_input('<CR>')
|
||||
local vim_errmsg = meths.nvim_eval('v:errmsg')
|
||||
api.nvim_command('enew')
|
||||
api.nvim_call_function('termopen', { command, env and { env = env } or nil })
|
||||
api.nvim_input('<CR>')
|
||||
local vim_errmsg = api.nvim_eval('v:errmsg')
|
||||
if vim_errmsg and '' ~= vim_errmsg then
|
||||
error(vim_errmsg)
|
||||
end
|
||||
|
||||
meths.nvim_command('setlocal scrollback=10')
|
||||
meths.nvim_command('startinsert')
|
||||
meths.nvim_input('<Ignore>') -- Add input to separate two RPC requests
|
||||
api.nvim_command('setlocal scrollback=10')
|
||||
api.nvim_command('startinsert')
|
||||
api.nvim_input('<Ignore>') -- Add input to separate two RPC requests
|
||||
|
||||
-- tty-test puts the terminal into raw mode and echoes input. Tests work by
|
||||
-- feeding termcodes to control the display and asserting by screen:expect.
|
||||
@@ -147,7 +147,7 @@ local function screen_setup(extra_rows, command, cols, env, screen_opts)
|
||||
screen:expect(table.concat(expected, '|\n') .. '|')
|
||||
else
|
||||
-- This eval also acts as a poke_eventloop().
|
||||
if 0 == meths.nvim_eval("exists('b:terminal_job_id')") then
|
||||
if 0 == api.nvim_eval("exists('b:terminal_job_id')") then
|
||||
error('terminal job failed to start')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,11 +2,11 @@ local helpers = require('test.functional.helpers')(after_each)
|
||||
local Screen = require('test.functional.ui.screen')
|
||||
local thelpers = require('test.functional.terminal.helpers')
|
||||
local feed, clear = helpers.feed, helpers.clear
|
||||
local meths = helpers.meths
|
||||
local api = helpers.api
|
||||
local testprg, command = helpers.testprg, helpers.command
|
||||
local nvim_prog_abs = helpers.nvim_prog_abs
|
||||
local eq, eval = helpers.eq, helpers.eval
|
||||
local funcs = helpers.funcs
|
||||
local fn = helpers.fn
|
||||
local nvim_set = helpers.nvim_set
|
||||
local is_os = helpers.is_os
|
||||
local skip = helpers.skip
|
||||
@@ -151,7 +151,7 @@ it(':terminal highlight has lower precedence than editor #9964', function()
|
||||
})
|
||||
screen:attach({ rgb = true })
|
||||
-- Child nvim process in :terminal (with cterm colors).
|
||||
funcs.termopen({
|
||||
fn.termopen({
|
||||
nvim_prog_abs(),
|
||||
'-n',
|
||||
'-u',
|
||||
@@ -251,7 +251,7 @@ describe(':terminal highlight with custom palette', function()
|
||||
[9] = { bold = true },
|
||||
})
|
||||
screen:attach({ rgb = true })
|
||||
meths.nvim_set_var('terminal_color_3', '#123456')
|
||||
api.nvim_set_var('terminal_color_3', '#123456')
|
||||
command(("enew | call termopen(['%s'])"):format(testprg('tty-test')))
|
||||
feed('i')
|
||||
screen:expect([[
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local helpers = require('test.functional.helpers')(after_each)
|
||||
local thelpers = require('test.functional.terminal.helpers')
|
||||
local clear, eq, eval = helpers.clear, helpers.eq, helpers.eval
|
||||
local feed, meths, command = helpers.feed, helpers.meths, helpers.command
|
||||
local feed, api, command = helpers.feed, helpers.api, helpers.command
|
||||
local feed_data = thelpers.feed_data
|
||||
local is_os = helpers.is_os
|
||||
local skip = helpers.skip
|
||||
@@ -11,7 +11,7 @@ describe(':terminal mouse', function()
|
||||
|
||||
before_each(function()
|
||||
clear()
|
||||
meths.nvim_set_option_value('statusline', '==========', {})
|
||||
api.nvim_set_option_value('statusline', '==========', {})
|
||||
command('highlight StatusLine cterm=NONE')
|
||||
command('highlight StatusLineNC cterm=NONE')
|
||||
command('highlight VertSplit cterm=NONE')
|
||||
@@ -514,7 +514,7 @@ describe(':terminal mouse', function()
|
||||
end)
|
||||
|
||||
it('handles terminal size when switching buffers', function()
|
||||
meths.nvim_set_option_value('hidden', true, {})
|
||||
api.nvim_set_option_value('hidden', true, {})
|
||||
feed('<c-\\><c-n><c-w><c-w>')
|
||||
screen:expect([[
|
||||
{7: 27 }line │line30 |
|
||||
|
||||
@@ -7,7 +7,7 @@ local eval = helpers.eval
|
||||
local command = helpers.command
|
||||
local poke_eventloop = helpers.poke_eventloop
|
||||
local retry = helpers.retry
|
||||
local meths = helpers.meths
|
||||
local api = helpers.api
|
||||
local feed_data = thelpers.feed_data
|
||||
local pcall_err = helpers.pcall_err
|
||||
local exec_lua = helpers.exec_lua
|
||||
@@ -85,7 +85,7 @@ describe(':terminal scrollback', function()
|
||||
{1: } |
|
||||
{3:-- TERMINAL --} |
|
||||
]])
|
||||
eq(7, meths.nvim_buf_line_count(0))
|
||||
eq(7, api.nvim_buf_line_count(0))
|
||||
end)
|
||||
|
||||
describe('and then 3 more lines are printed', function()
|
||||
@@ -169,7 +169,7 @@ describe(':terminal scrollback', function()
|
||||
{2:^ } |
|
||||
|
|
||||
]])
|
||||
eq(8, meths.nvim_buf_line_count(0))
|
||||
eq(8, api.nvim_buf_line_count(0))
|
||||
feed([[3k]])
|
||||
screen:expect([[
|
||||
^line4 |
|
||||
@@ -203,7 +203,7 @@ describe(':terminal scrollback', function()
|
||||
|
|
||||
{3:-- TERMINAL --} |
|
||||
]])
|
||||
eq(4, meths.nvim_buf_line_count(0))
|
||||
eq(4, api.nvim_buf_line_count(0))
|
||||
end
|
||||
|
||||
it('will delete the last two empty lines', will_delete_last_two_lines)
|
||||
@@ -221,7 +221,7 @@ describe(':terminal scrollback', function()
|
||||
{1: } |
|
||||
{3:-- TERMINAL --} |
|
||||
]])
|
||||
eq(4, meths.nvim_buf_line_count(0))
|
||||
eq(4, api.nvim_buf_line_count(0))
|
||||
feed('<c-\\><c-n>gg')
|
||||
screen:expect([[
|
||||
^tty ready |
|
||||
@@ -260,7 +260,7 @@ describe(':terminal scrollback', function()
|
||||
{1: } |
|
||||
{3:-- TERMINAL --} |
|
||||
]])
|
||||
eq(7, meths.nvim_buf_line_count(0))
|
||||
eq(7, api.nvim_buf_line_count(0))
|
||||
end)
|
||||
|
||||
describe('and the height is increased by 1', function()
|
||||
@@ -286,7 +286,7 @@ describe(':terminal scrollback', function()
|
||||
describe('and then by 3', function()
|
||||
before_each(function()
|
||||
pop_then_push()
|
||||
eq(8, meths.nvim_buf_line_count(0))
|
||||
eq(8, api.nvim_buf_line_count(0))
|
||||
screen:try_resize(screen._width, screen._height + 3)
|
||||
end)
|
||||
|
||||
@@ -301,7 +301,7 @@ describe(':terminal scrollback', function()
|
||||
{1: } |
|
||||
{3:-- TERMINAL --} |
|
||||
]])
|
||||
eq(9, meths.nvim_buf_line_count(0))
|
||||
eq(9, api.nvim_buf_line_count(0))
|
||||
feed('<c-\\><c-n>gg')
|
||||
screen:expect([[
|
||||
^tty ready |
|
||||
@@ -341,7 +341,7 @@ describe(':terminal scrollback', function()
|
||||
]])
|
||||
-- since there's an empty line after the cursor, the buffer line
|
||||
-- count equals the terminal screen height
|
||||
eq(11, meths.nvim_buf_line_count(0))
|
||||
eq(11, api.nvim_buf_line_count(0))
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
@@ -380,7 +380,7 @@ describe("'scrollback' option", function()
|
||||
end)
|
||||
|
||||
local function set_fake_shell()
|
||||
meths.nvim_set_option_value('shell', string.format('"%s" INTERACT', testprg('shell-test')), {})
|
||||
api.nvim_set_option_value('shell', string.format('"%s" INTERACT', testprg('shell-test')), {})
|
||||
end
|
||||
|
||||
local function expect_lines(expected, epsilon)
|
||||
@@ -399,7 +399,7 @@ describe("'scrollback' option", function()
|
||||
screen = thelpers.screen_setup(nil, { 'sh' }, 30)
|
||||
end
|
||||
|
||||
meths.nvim_set_option_value('scrollback', 0, {})
|
||||
api.nvim_set_option_value('scrollback', 0, {})
|
||||
feed_data(('%s REP 31 line%s'):format(testprg('shell-test'), is_os('win') and '\r' or '\n'))
|
||||
screen:expect { any = '30: line ' }
|
||||
retry(nil, nil, function()
|
||||
@@ -417,7 +417,7 @@ describe("'scrollback' option", function()
|
||||
screen = thelpers.screen_setup(nil, { 'sh' }, 30)
|
||||
end
|
||||
|
||||
meths.nvim_set_option_value('scrollback', 200, {})
|
||||
api.nvim_set_option_value('scrollback', 200, {})
|
||||
|
||||
-- Wait for prompt.
|
||||
screen:expect { any = '%$' }
|
||||
@@ -428,12 +428,12 @@ describe("'scrollback' option", function()
|
||||
retry(nil, nil, function()
|
||||
expect_lines(33, 2)
|
||||
end)
|
||||
meths.nvim_set_option_value('scrollback', 10, {})
|
||||
api.nvim_set_option_value('scrollback', 10, {})
|
||||
poke_eventloop()
|
||||
retry(nil, nil, function()
|
||||
expect_lines(16)
|
||||
end)
|
||||
meths.nvim_set_option_value('scrollback', 10000, {})
|
||||
api.nvim_set_option_value('scrollback', 10000, {})
|
||||
retry(nil, nil, function()
|
||||
expect_lines(16)
|
||||
end)
|
||||
@@ -494,18 +494,18 @@ describe("'scrollback' option", function()
|
||||
]])
|
||||
local term_height = 6 -- Actual terminal screen height, not the scrollback
|
||||
-- Initial
|
||||
local scrollback = meths.nvim_get_option_value('scrollback', {})
|
||||
local scrollback = api.nvim_get_option_value('scrollback', {})
|
||||
eq(scrollback + term_height, eval('line("$")'))
|
||||
-- Reduction
|
||||
scrollback = scrollback - 2
|
||||
meths.nvim_set_option_value('scrollback', scrollback, {})
|
||||
api.nvim_set_option_value('scrollback', scrollback, {})
|
||||
eq(scrollback + term_height, eval('line("$")'))
|
||||
end)
|
||||
|
||||
it('defaults to 10000 in :terminal buffers', function()
|
||||
set_fake_shell()
|
||||
command('terminal')
|
||||
eq(10000, meths.nvim_get_option_value('scrollback', {}))
|
||||
eq(10000, api.nvim_get_option_value('scrollback', {}))
|
||||
end)
|
||||
|
||||
it('error if set to invalid value', function()
|
||||
@@ -518,7 +518,7 @@ describe("'scrollback' option", function()
|
||||
|
||||
it('defaults to -1 on normal buffers', function()
|
||||
command('new')
|
||||
eq(-1, meths.nvim_get_option_value('scrollback', {}))
|
||||
eq(-1, api.nvim_get_option_value('scrollback', {}))
|
||||
end)
|
||||
|
||||
it(':setlocal in a :terminal buffer', function()
|
||||
@@ -527,45 +527,45 @@ describe("'scrollback' option", function()
|
||||
-- _Global_ scrollback=-1 defaults :terminal to 10_000.
|
||||
command('setglobal scrollback=-1')
|
||||
command('terminal')
|
||||
eq(10000, meths.nvim_get_option_value('scrollback', {}))
|
||||
eq(10000, api.nvim_get_option_value('scrollback', {}))
|
||||
|
||||
-- _Local_ scrollback=-1 in :terminal forces the _maximum_.
|
||||
command('setlocal scrollback=-1')
|
||||
retry(nil, nil, function() -- Fixup happens on refresh, not immediately.
|
||||
eq(100000, meths.nvim_get_option_value('scrollback', {}))
|
||||
eq(100000, api.nvim_get_option_value('scrollback', {}))
|
||||
end)
|
||||
|
||||
-- _Local_ scrollback=-1 during TermOpen forces the maximum. #9605
|
||||
command('setglobal scrollback=-1')
|
||||
command('autocmd TermOpen * setlocal scrollback=-1')
|
||||
command('terminal')
|
||||
eq(100000, meths.nvim_get_option_value('scrollback', {}))
|
||||
eq(100000, api.nvim_get_option_value('scrollback', {}))
|
||||
end)
|
||||
|
||||
it(':setlocal in a normal buffer', function()
|
||||
command('new')
|
||||
-- :setlocal to -1.
|
||||
command('setlocal scrollback=-1')
|
||||
eq(-1, meths.nvim_get_option_value('scrollback', {}))
|
||||
eq(-1, api.nvim_get_option_value('scrollback', {}))
|
||||
-- :setlocal to anything except -1. Currently, this just has no effect.
|
||||
command('setlocal scrollback=42')
|
||||
eq(42, meths.nvim_get_option_value('scrollback', {}))
|
||||
eq(42, api.nvim_get_option_value('scrollback', {}))
|
||||
end)
|
||||
|
||||
it(':set updates local value and global default', function()
|
||||
set_fake_shell()
|
||||
command('set scrollback=42') -- set global value
|
||||
eq(42, meths.nvim_get_option_value('scrollback', {}))
|
||||
eq(42, api.nvim_get_option_value('scrollback', {}))
|
||||
command('terminal')
|
||||
eq(42, meths.nvim_get_option_value('scrollback', {})) -- inherits global default
|
||||
eq(42, api.nvim_get_option_value('scrollback', {})) -- inherits global default
|
||||
command('setlocal scrollback=99')
|
||||
eq(99, meths.nvim_get_option_value('scrollback', {}))
|
||||
eq(99, api.nvim_get_option_value('scrollback', {}))
|
||||
command('set scrollback<') -- reset to global default
|
||||
eq(42, meths.nvim_get_option_value('scrollback', {}))
|
||||
eq(42, api.nvim_get_option_value('scrollback', {}))
|
||||
command('setglobal scrollback=734') -- new global default
|
||||
eq(42, meths.nvim_get_option_value('scrollback', {})) -- local value did not change
|
||||
eq(42, api.nvim_get_option_value('scrollback', {})) -- local value did not change
|
||||
command('terminal')
|
||||
eq(734, meths.nvim_get_option_value('scrollback', {}))
|
||||
eq(734, api.nvim_get_option_value('scrollback', {}))
|
||||
end)
|
||||
end)
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ local nvim_prog = helpers.nvim_prog
|
||||
local nvim_set = helpers.nvim_set
|
||||
local ok = helpers.ok
|
||||
local read_file = helpers.read_file
|
||||
local funcs = helpers.funcs
|
||||
local meths = helpers.meths
|
||||
local fn = helpers.fn
|
||||
local api = helpers.api
|
||||
local is_ci = helpers.is_ci
|
||||
local is_os = helpers.is_os
|
||||
local new_pipename = helpers.new_pipename
|
||||
@@ -375,7 +375,7 @@ describe('TUI', function()
|
||||
if esc then
|
||||
feed_data('\027[<65;8;1M')
|
||||
else
|
||||
meths.nvim_input_mouse('wheel', 'down', '', 0, 0, 7)
|
||||
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----|
|
||||
@@ -390,7 +390,7 @@ describe('TUI', function()
|
||||
if esc then
|
||||
feed_data('\027[<65;48;1M')
|
||||
else
|
||||
meths.nvim_input_mouse('wheel', 'down', '', 0, 0, 47)
|
||||
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----|
|
||||
@@ -405,7 +405,7 @@ describe('TUI', function()
|
||||
if esc then
|
||||
feed_data('\027[<67;8;1M')
|
||||
else
|
||||
meths.nvim_input_mouse('wheel', 'right', '', 0, 0, 7)
|
||||
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----|
|
||||
@@ -420,7 +420,7 @@ describe('TUI', function()
|
||||
if esc then
|
||||
feed_data('\027[<67;48;1M')
|
||||
else
|
||||
meths.nvim_input_mouse('wheel', 'right', '', 0, 0, 47)
|
||||
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|
|
||||
@@ -435,7 +435,7 @@ describe('TUI', function()
|
||||
if esc then
|
||||
feed_data('\027[<69;8;1M')
|
||||
else
|
||||
meths.nvim_input_mouse('wheel', 'down', 'S', 0, 0, 7)
|
||||
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|
|
||||
@@ -450,7 +450,7 @@ describe('TUI', function()
|
||||
if esc then
|
||||
feed_data('\027[<69;48;1M')
|
||||
else
|
||||
meths.nvim_input_mouse('wheel', 'down', 'S', 0, 0, 47)
|
||||
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|
|
||||
@@ -465,7 +465,7 @@ describe('TUI', function()
|
||||
if esc then
|
||||
feed_data('\027[<71;8;1M')
|
||||
else
|
||||
meths.nvim_input_mouse('wheel', 'right', 'S', 0, 0, 7)
|
||||
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|
|
||||
@@ -480,7 +480,7 @@ describe('TUI', function()
|
||||
if esc then
|
||||
feed_data('\027[<71;48;1M')
|
||||
else
|
||||
meths.nvim_input_mouse('wheel', 'right', 'S', 0, 0, 47)
|
||||
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----|
|
||||
@@ -495,7 +495,7 @@ describe('TUI', function()
|
||||
if esc then
|
||||
feed_data('\027[<64;8;1M')
|
||||
else
|
||||
meths.nvim_input_mouse('wheel', 'up', '', 0, 0, 7)
|
||||
api.nvim_input_mouse('wheel', 'up', '', 0, 0, 7)
|
||||
end
|
||||
screen:expect([[
|
||||
{11: 4 }----6----7----8----9 │{11: 5 }5----6----7----8----|
|
||||
@@ -510,7 +510,7 @@ describe('TUI', function()
|
||||
if esc then
|
||||
feed_data('\027[<64;48;1M')
|
||||
else
|
||||
meths.nvim_input_mouse('wheel', 'up', '', 0, 0, 47)
|
||||
api.nvim_input_mouse('wheel', 'up', '', 0, 0, 47)
|
||||
end
|
||||
screen:expect([[
|
||||
{11: 4 }----6----7----8----9 │{11: 4 }5----6----7----8----|
|
||||
@@ -525,7 +525,7 @@ describe('TUI', function()
|
||||
if esc then
|
||||
feed_data('\027[<66;8;1M')
|
||||
else
|
||||
meths.nvim_input_mouse('wheel', 'left', '', 0, 0, 7)
|
||||
api.nvim_input_mouse('wheel', 'left', '', 0, 0, 7)
|
||||
end
|
||||
screen:expect([[
|
||||
{11: 4 }5----6----7----8----9│{11: 4 }5----6----7----8----|
|
||||
@@ -540,7 +540,7 @@ describe('TUI', function()
|
||||
if esc then
|
||||
feed_data('\027[<66;48;1M')
|
||||
else
|
||||
meths.nvim_input_mouse('wheel', 'left', '', 0, 0, 47)
|
||||
api.nvim_input_mouse('wheel', 'left', '', 0, 0, 47)
|
||||
end
|
||||
screen:expect([[
|
||||
{11: 4 }5----6----7----8----9│{11: 4 }-5----6----7----8---|
|
||||
@@ -555,7 +555,7 @@ describe('TUI', function()
|
||||
if esc then
|
||||
feed_data('\027[<68;8;1M')
|
||||
else
|
||||
meths.nvim_input_mouse('wheel', 'up', 'S', 0, 0, 7)
|
||||
api.nvim_input_mouse('wheel', 'up', 'S', 0, 0, 7)
|
||||
end
|
||||
screen:expect([[
|
||||
{11: 1 }5----6----7----8----9│{11: 4 }-5----6----7----8---|
|
||||
@@ -570,7 +570,7 @@ describe('TUI', function()
|
||||
if esc then
|
||||
feed_data('\027[<68;48;1M')
|
||||
else
|
||||
meths.nvim_input_mouse('wheel', 'up', 'S', 0, 0, 47)
|
||||
api.nvim_input_mouse('wheel', 'up', 'S', 0, 0, 47)
|
||||
end
|
||||
screen:expect([[
|
||||
{11: 1 }5----6----7----8----9│{11: 1 }-5----6----7----8---|
|
||||
@@ -585,7 +585,7 @@ describe('TUI', function()
|
||||
if esc then
|
||||
feed_data('\027[<70;8;1M')
|
||||
else
|
||||
meths.nvim_input_mouse('wheel', 'left', 'S', 0, 0, 7)
|
||||
api.nvim_input_mouse('wheel', 'left', 'S', 0, 0, 7)
|
||||
end
|
||||
screen:expect([[
|
||||
{11: 1 }0----1----2----3----4│{11: 1 }-5----6----7----8---|
|
||||
@@ -600,7 +600,7 @@ describe('TUI', function()
|
||||
if esc then
|
||||
feed_data('\027[<70;48;1M')
|
||||
else
|
||||
meths.nvim_input_mouse('wheel', 'left', 'S', 0, 0, 47)
|
||||
api.nvim_input_mouse('wheel', 'left', 'S', 0, 0, 47)
|
||||
end
|
||||
screen:expect([[
|
||||
{11: 1 }0----1----2----3----4│{11: 1 }0----1----2----3----|
|
||||
@@ -642,7 +642,7 @@ describe('TUI', function()
|
||||
if esc then
|
||||
feed_data('\027[<2;5;1M')
|
||||
else
|
||||
meths.nvim_input_mouse('right', 'press', '', 0, 0, 4)
|
||||
api.nvim_input_mouse('right', 'press', '', 0, 0, 4)
|
||||
end
|
||||
screen:expect([[
|
||||
{1:p}opup menu test |
|
||||
@@ -656,13 +656,13 @@ describe('TUI', function()
|
||||
if esc then
|
||||
feed_data('\027[<2;5;1m')
|
||||
else
|
||||
meths.nvim_input_mouse('right', 'release', '', 0, 0, 4)
|
||||
api.nvim_input_mouse('right', 'release', '', 0, 0, 4)
|
||||
end
|
||||
screen:expect_unchanged()
|
||||
if esc then
|
||||
feed_data('\027[<35;7;4M')
|
||||
else
|
||||
meths.nvim_input_mouse('move', '', '', 0, 3, 6)
|
||||
api.nvim_input_mouse('move', '', '', 0, 3, 6)
|
||||
end
|
||||
screen:expect([[
|
||||
{1:p}opup menu test |
|
||||
@@ -676,7 +676,7 @@ describe('TUI', function()
|
||||
if esc then
|
||||
feed_data('\027[<0;7;3M')
|
||||
else
|
||||
meths.nvim_input_mouse('left', 'press', '', 0, 2, 6)
|
||||
api.nvim_input_mouse('left', 'press', '', 0, 2, 6)
|
||||
end
|
||||
screen:expect([[
|
||||
{1:p}opup menu test |
|
||||
@@ -688,13 +688,13 @@ describe('TUI', function()
|
||||
if esc then
|
||||
feed_data('\027[<0;7;3m')
|
||||
else
|
||||
meths.nvim_input_mouse('left', 'release', '', 0, 2, 6)
|
||||
api.nvim_input_mouse('left', 'release', '', 0, 2, 6)
|
||||
end
|
||||
screen:expect_unchanged()
|
||||
if esc then
|
||||
feed_data('\027[<2;45;3M')
|
||||
else
|
||||
meths.nvim_input_mouse('right', 'press', '', 0, 2, 44)
|
||||
api.nvim_input_mouse('right', 'press', '', 0, 2, 44)
|
||||
end
|
||||
screen:expect([[
|
||||
{1:p}opup menu test |
|
||||
@@ -707,7 +707,7 @@ describe('TUI', function()
|
||||
if esc then
|
||||
feed_data('\027[<34;48;6M')
|
||||
else
|
||||
meths.nvim_input_mouse('right', 'drag', '', 0, 5, 47)
|
||||
api.nvim_input_mouse('right', 'drag', '', 0, 5, 47)
|
||||
end
|
||||
screen:expect([[
|
||||
{1:p}opup menu test |
|
||||
@@ -720,7 +720,7 @@ describe('TUI', function()
|
||||
if esc then
|
||||
feed_data('\027[<2;48;6m')
|
||||
else
|
||||
meths.nvim_input_mouse('right', 'release', '', 0, 5, 47)
|
||||
api.nvim_input_mouse('right', 'release', '', 0, 5, 47)
|
||||
end
|
||||
screen:expect([[
|
||||
{1:p}opup menu test |
|
||||
@@ -743,23 +743,23 @@ describe('TUI', function()
|
||||
|
||||
it('accepts keypad keys from kitty keyboard protocol #19180', function()
|
||||
feed_data('i')
|
||||
feed_data(funcs.nr2char(57399)) -- KP_0
|
||||
feed_data(funcs.nr2char(57400)) -- KP_1
|
||||
feed_data(funcs.nr2char(57401)) -- KP_2
|
||||
feed_data(funcs.nr2char(57402)) -- KP_3
|
||||
feed_data(funcs.nr2char(57403)) -- KP_4
|
||||
feed_data(funcs.nr2char(57404)) -- KP_5
|
||||
feed_data(funcs.nr2char(57405)) -- KP_6
|
||||
feed_data(funcs.nr2char(57406)) -- KP_7
|
||||
feed_data(funcs.nr2char(57407)) -- KP_8
|
||||
feed_data(funcs.nr2char(57408)) -- KP_9
|
||||
feed_data(funcs.nr2char(57409)) -- KP_DECIMAL
|
||||
feed_data(funcs.nr2char(57410)) -- KP_DIVIDE
|
||||
feed_data(funcs.nr2char(57411)) -- KP_MULTIPLY
|
||||
feed_data(funcs.nr2char(57412)) -- KP_SUBTRACT
|
||||
feed_data(funcs.nr2char(57413)) -- KP_ADD
|
||||
feed_data(funcs.nr2char(57414)) -- KP_ENTER
|
||||
feed_data(funcs.nr2char(57415)) -- KP_EQUAL
|
||||
feed_data(fn.nr2char(57399)) -- KP_0
|
||||
feed_data(fn.nr2char(57400)) -- KP_1
|
||||
feed_data(fn.nr2char(57401)) -- KP_2
|
||||
feed_data(fn.nr2char(57402)) -- KP_3
|
||||
feed_data(fn.nr2char(57403)) -- KP_4
|
||||
feed_data(fn.nr2char(57404)) -- KP_5
|
||||
feed_data(fn.nr2char(57405)) -- KP_6
|
||||
feed_data(fn.nr2char(57406)) -- KP_7
|
||||
feed_data(fn.nr2char(57407)) -- KP_8
|
||||
feed_data(fn.nr2char(57408)) -- KP_9
|
||||
feed_data(fn.nr2char(57409)) -- KP_DECIMAL
|
||||
feed_data(fn.nr2char(57410)) -- KP_DIVIDE
|
||||
feed_data(fn.nr2char(57411)) -- KP_MULTIPLY
|
||||
feed_data(fn.nr2char(57412)) -- KP_SUBTRACT
|
||||
feed_data(fn.nr2char(57413)) -- KP_ADD
|
||||
feed_data(fn.nr2char(57414)) -- KP_ENTER
|
||||
feed_data(fn.nr2char(57415)) -- KP_EQUAL
|
||||
screen:expect([[
|
||||
0123456789./*-+ |
|
||||
={1: } |
|
||||
@@ -768,7 +768,7 @@ describe('TUI', function()
|
||||
{3:-- INSERT --} |
|
||||
{3:-- TERMINAL --} |
|
||||
]])
|
||||
feed_data(funcs.nr2char(57417)) -- KP_LEFT
|
||||
feed_data(fn.nr2char(57417)) -- KP_LEFT
|
||||
screen:expect([[
|
||||
0123456789./*-+ |
|
||||
{1:=} |
|
||||
@@ -777,7 +777,7 @@ describe('TUI', function()
|
||||
{3:-- INSERT --} |
|
||||
{3:-- TERMINAL --} |
|
||||
]])
|
||||
feed_data(funcs.nr2char(57418)) -- KP_RIGHT
|
||||
feed_data(fn.nr2char(57418)) -- KP_RIGHT
|
||||
screen:expect([[
|
||||
0123456789./*-+ |
|
||||
={1: } |
|
||||
@@ -786,7 +786,7 @@ describe('TUI', function()
|
||||
{3:-- INSERT --} |
|
||||
{3:-- TERMINAL --} |
|
||||
]])
|
||||
feed_data(funcs.nr2char(57419)) -- KP_UP
|
||||
feed_data(fn.nr2char(57419)) -- KP_UP
|
||||
screen:expect([[
|
||||
0{1:1}23456789./*-+ |
|
||||
= |
|
||||
@@ -795,7 +795,7 @@ describe('TUI', function()
|
||||
{3:-- INSERT --} |
|
||||
{3:-- TERMINAL --} |
|
||||
]])
|
||||
feed_data(funcs.nr2char(57420)) -- KP_DOWN
|
||||
feed_data(fn.nr2char(57420)) -- KP_DOWN
|
||||
screen:expect([[
|
||||
0123456789./*-+ |
|
||||
={1: } |
|
||||
@@ -804,7 +804,7 @@ describe('TUI', function()
|
||||
{3:-- INSERT --} |
|
||||
{3:-- TERMINAL --} |
|
||||
]])
|
||||
feed_data(funcs.nr2char(57425)) -- KP_INSERT
|
||||
feed_data(fn.nr2char(57425)) -- KP_INSERT
|
||||
screen:expect([[
|
||||
0123456789./*-+ |
|
||||
={1: } |
|
||||
@@ -840,7 +840,7 @@ describe('TUI', function()
|
||||
|
|
||||
{3:-- TERMINAL --} |
|
||||
]])
|
||||
feed_data(funcs.nr2char(57426)) -- KP_DELETE
|
||||
feed_data(fn.nr2char(57426)) -- KP_DELETE
|
||||
screen:expect([[
|
||||
0123456789{1:/}*-+ |
|
||||
= |
|
||||
@@ -849,7 +849,7 @@ describe('TUI', function()
|
||||
|
|
||||
{3:-- TERMINAL --} |
|
||||
]])
|
||||
feed_data(funcs.nr2char(57423)) -- KP_HOME
|
||||
feed_data(fn.nr2char(57423)) -- KP_HOME
|
||||
screen:expect([[
|
||||
{1:0}123456789/*-+ |
|
||||
= |
|
||||
@@ -858,7 +858,7 @@ describe('TUI', function()
|
||||
|
|
||||
{3:-- TERMINAL --} |
|
||||
]])
|
||||
feed_data(funcs.nr2char(57424)) -- KP_END
|
||||
feed_data(fn.nr2char(57424)) -- KP_END
|
||||
screen:expect([[
|
||||
0123456789/*-{1:+} |
|
||||
= |
|
||||
@@ -1903,7 +1903,7 @@ describe('TUI', function()
|
||||
[5] = { bold = true, reverse = true },
|
||||
})
|
||||
screen:attach()
|
||||
funcs.termopen({
|
||||
fn.termopen({
|
||||
nvim_prog,
|
||||
'--clean',
|
||||
'--cmd',
|
||||
@@ -2989,7 +2989,7 @@ describe('TUI as a client', function()
|
||||
local client_super = spawn_argv(true)
|
||||
|
||||
set_session(server)
|
||||
local server_pipe = meths.nvim_get_vvar('servername')
|
||||
local server_pipe = api.nvim_get_vvar('servername')
|
||||
server:request('nvim_input', 'iHalloj!<Esc>')
|
||||
server:request('nvim_command', 'set notermguicolors')
|
||||
|
||||
@@ -3022,10 +3022,10 @@ describe('TUI as a client', function()
|
||||
]],
|
||||
}
|
||||
|
||||
eq(0, meths.nvim_get_vvar('shell_error'))
|
||||
eq(0, api.nvim_get_vvar('shell_error'))
|
||||
-- exits on input eof #22244
|
||||
funcs.system({ nvim_prog, '--server', server_pipe, '--remote-ui' })
|
||||
eq(1, meths.nvim_get_vvar('shell_error'))
|
||||
fn.system({ nvim_prog, '--server', server_pipe, '--remote-ui' })
|
||||
eq(1, api.nvim_get_vvar('shell_error'))
|
||||
|
||||
client_super:close()
|
||||
server:close()
|
||||
|
||||
@@ -7,7 +7,7 @@ local feed_command = helpers.feed_command
|
||||
local command = helpers.command
|
||||
local eq = helpers.eq
|
||||
local eval = helpers.eval
|
||||
local meths = helpers.meths
|
||||
local api = helpers.api
|
||||
local sleep = vim.uv.sleep
|
||||
local retry = helpers.retry
|
||||
local is_os = helpers.is_os
|
||||
@@ -19,7 +19,7 @@ describe(':terminal', function()
|
||||
clear()
|
||||
-- set the statusline to a constant value because of variables like pid
|
||||
-- and current directory and to improve visibility of splits
|
||||
meths.nvim_set_option_value('statusline', '==========', {})
|
||||
api.nvim_set_option_value('statusline', '==========', {})
|
||||
command('highlight StatusLine cterm=NONE')
|
||||
command('highlight StatusLineNC cterm=NONE')
|
||||
command('highlight VertSplit cterm=NONE')
|
||||
@@ -69,10 +69,10 @@ describe(':terminal', function()
|
||||
end)
|
||||
|
||||
it('does not change size if updated when not visible in any window #19665', function()
|
||||
local channel = meths.nvim_get_option_value('channel', {})
|
||||
local channel = api.nvim_get_option_value('channel', {})
|
||||
command('enew')
|
||||
sleep(100)
|
||||
meths.nvim_chan_send(channel, 'foo')
|
||||
api.nvim_chan_send(channel, 'foo')
|
||||
sleep(100)
|
||||
command('bprevious')
|
||||
screen:expect([[
|
||||
|
||||
Reference in New Issue
Block a user