aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/terminal/helpers.lua4
-rw-r--r--test/functional/terminal/tui_spec.lua46
-rw-r--r--test/functional/ui/input_spec.lua4
3 files changed, 46 insertions, 8 deletions
diff --git a/test/functional/terminal/helpers.lua b/test/functional/terminal/helpers.lua
index c5315d0185..51ecae663a 100644
--- a/test/functional/terminal/helpers.lua
+++ b/test/functional/terminal/helpers.lua
@@ -7,7 +7,9 @@ local nvim_dir = helpers.nvim_dir
local feed_command, nvim = helpers.feed_command, helpers.nvim
local function feed_data(data)
- nvim('set_var', 'term_data', data)
+ -- A string containing NUL bytes is not converted to a Blob when
+ -- calling nvim_set_var() API, so convert it using Lua instead.
+ nvim('exec_lua', 'vim.g.term_data = ...', {data})
nvim('command', 'call jobsend(b:terminal_job_id, term_data)')
end
diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua
index c37cde06ab..8c6cba4def 100644
--- a/test/functional/terminal/tui_spec.lua
+++ b/test/functional/terminal/tui_spec.lua
@@ -214,7 +214,7 @@ describe('TUI', function()
]])
end)
- it('interprets ESC+key as ALT chord', function()
+ it('interprets ESC+key as ALT chord in i_CTRL-V', function()
-- Vim represents ALT/META by setting the "high bit" of the modified key:
-- ALT+j inserts "ê". Nvim does not (#3982).
feed_data('i\022\027j')
@@ -229,6 +229,38 @@ describe('TUI', function()
]])
end)
+ it('interprets <Esc>[27u as <Esc>', function()
+ feed_command('nnoremap <M-;> <Nop>')
+ feed_command('nnoremap <Esc> AESC<Esc>')
+ feed_command('nnoremap ; Asemicolon<Esc>')
+ feed_data('\027[27u;')
+ screen:expect([[
+ ESCsemicolo{1:n} |
+ {4:~ }|
+ {4:~ }|
+ {4:~ }|
+ {5:[No Name] [+] }|
+ |
+ {3:-- TERMINAL --} |
+ ]])
+ -- <Esc>; should be recognized as <M-;> when <M-;> is mapped
+ feed_data('\027;')
+ screen:expect_unchanged()
+ end)
+
+ it('interprets <Esc><Nul> as <M-C-Space> #17198', function()
+ feed_data('i\022\027\000')
+ screen:expect([[
+ <M-C-Space>{1: } |
+ {4:~ }|
+ {4:~ }|
+ {4:~ }|
+ {5:[No Name] [+] }|
+ {3:-- INSERT --} |
+ {3:-- TERMINAL --} |
+ ]])
+ end)
+
it('accepts ASCII control sequences', function()
feed_data('i')
feed_data('\022\007') -- ctrl+g
@@ -271,7 +303,7 @@ describe('TUI', function()
{3:-- TERMINAL --} |
]])
feed_data('\027[201~') -- End paste.
- feed_data('\027\000') -- ESC: go to Normal mode.
+ feed_data('\027[27u') -- ESC: go to Normal mode.
wait_for_mode('n')
screen:expect([[
"pasted from termina{1:l}" |
@@ -453,7 +485,7 @@ describe('TUI', function()
{3:-- TERMINAL --} |
]]}
-- Dot-repeat/redo.
- feed_data('\027\000')
+ feed_data('\027[27u')
wait_for_mode('n')
feed_data('.')
screen:expect{grid=[[
@@ -499,7 +531,7 @@ describe('TUI', function()
vim.paste = function(lines, phase) error("fake fail") end
]], {})
-- Prepare something for dot-repeat/redo.
- feed_data('ifoo\n\027\000')
+ feed_data('ifoo\n\027[27u')
wait_for_mode('n')
screen:expect{grid=[[
foo |
@@ -541,7 +573,7 @@ describe('TUI', function()
{3:-- TERMINAL --} |
]]}
-- Editor should still work after failed/drained paste.
- feed_data('ityped input...\027\000')
+ feed_data('ityped input...\027[27u')
screen:expect{grid=[[
foo |
foo |
@@ -575,7 +607,7 @@ describe('TUI', function()
vim.paste = function(lines, phase) return false end
]], {})
feed_data('\027[200~line A\nline B\n\027[201~')
- feed_data('ifoo\n\027\000')
+ feed_data('ifoo\n\027[27u')
expect_child_buf_lines({'foo',''})
end)
@@ -669,7 +701,7 @@ describe('TUI', function()
{3:-- INSERT --} |
{3:-- TERMINAL --} |
]])
- feed_data('\027\000') -- ESC: go to Normal mode.
+ feed_data('\027[27u') -- ESC: go to Normal mode.
wait_for_mode('n')
-- Dot-repeat/redo.
feed_data('.')
diff --git a/test/functional/ui/input_spec.lua b/test/functional/ui/input_spec.lua
index b581e147e3..8925dda730 100644
--- a/test/functional/ui/input_spec.lua
+++ b/test/functional/ui/input_spec.lua
@@ -52,6 +52,8 @@ describe('mappings', function()
add_mapping('<kenter>','<kenter>')
add_mapping('<kcomma>','<kcomma>')
add_mapping('<kequal>','<kequal>')
+ add_mapping('<f38>','<f38>')
+ add_mapping('<f63>','<f63>')
end)
it('ok', function()
@@ -108,6 +110,8 @@ describe('mappings', function()
check_mapping('<KPComma>','<kcomma>')
check_mapping('<kequal>','<kequal>')
check_mapping('<KPEquals>','<kequal>')
+ check_mapping('<f38>','<f38>')
+ check_mapping('<f63>','<f63>')
end)
it('support meta + multibyte char mapping', function()