aboutsummaryrefslogtreecommitdiff
path: root/test/functional/terminal/buffer_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/terminal/buffer_spec.lua')
-rw-r--r--test/functional/terminal/buffer_spec.lua68
1 files changed, 68 insertions, 0 deletions
diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua
index cc807ba555..50e23d9e23 100644
--- a/test/functional/terminal/buffer_spec.lua
+++ b/test/functional/terminal/buffer_spec.lua
@@ -625,6 +625,74 @@ describe('terminal input', function()
]]):format(key))
end
end)
+
+ -- TODO(bfredl): getcharstr() erases the distinction between <C-I> and <Tab>.
+ -- If it was enhanced or replaced this could get folded into the test above.
+ it('can send TAB/C-I and ESC/C-[ separately', function()
+ clear()
+ local screen = tt.setup_child_nvim({
+ '-u',
+ 'NONE',
+ '-i',
+ 'NONE',
+ '--cmd',
+ 'colorscheme vim',
+ '--cmd',
+ 'set notermguicolors',
+ '--cmd',
+ 'noremap <Tab> <cmd>echo "Tab!"<cr>',
+ '--cmd',
+ 'noremap <C-i> <cmd>echo "Ctrl-I!"<cr>',
+ '--cmd',
+ 'noremap <Esc> <cmd>echo "Esc!"<cr>',
+ '--cmd',
+ 'noremap <C-[> <cmd>echo "Ctrl-[!"<cr>',
+ })
+
+ screen:expect([[
+ ^ |
+ {4:~ }|*3
+ {5:[No Name] 0,0-1 All}|
+ |
+ {3:-- TERMINAL --} |
+ ]])
+
+ feed('<tab>')
+ screen:expect([[
+ ^ |
+ {4:~ }|*3
+ {5:[No Name] 0,0-1 All}|
+ Tab! |
+ {3:-- TERMINAL --} |
+ ]])
+
+ feed('<c-i>')
+ screen:expect([[
+ ^ |
+ {4:~ }|*3
+ {5:[No Name] 0,0-1 All}|
+ Ctrl-I! |
+ {3:-- TERMINAL --} |
+ ]])
+
+ feed('<Esc>')
+ screen:expect([[
+ ^ |
+ {4:~ }|*3
+ {5:[No Name] 0,0-1 All}|
+ Esc! |
+ {3:-- TERMINAL --} |
+ ]])
+
+ feed('<c-[>')
+ screen:expect([[
+ ^ |
+ {4:~ }|*3
+ {5:[No Name] 0,0-1 All}|
+ Ctrl-[! |
+ {3:-- TERMINAL --} |
+ ]])
+ end)
end)
if is_os('win') then