aboutsummaryrefslogtreecommitdiff
path: root/test/functional/terminal/buffer_spec.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2025-02-02 17:32:51 +0800
committerGitHub <noreply@github.com>2025-02-02 09:32:51 +0000
commit4bdabf9b1ae52134f50a0b75dc2c73a40c0c252f (patch)
tree1d57e428e413301df6a6d4c4cdbf7ff7853c8e7c /test/functional/terminal/buffer_spec.lua
parent718e9ce018572f609a7639865af55476a19847aa (diff)
downloadrneovim-4bdabf9b1ae52134f50a0b75dc2c73a40c0c252f.tar.gz
rneovim-4bdabf9b1ae52134f50a0b75dc2c73a40c0c252f.tar.bz2
rneovim-4bdabf9b1ae52134f50a0b75dc2c73a40c0c252f.zip
vim-patch:9.1.1068: getchar() can't distinguish between C-I and Tab (#32295)
Problem: getchar() can't distinguish between C-I and Tab. Solution: Add {opts} to pass extra flags to getchar() and getcharstr(), with "number" and "simplify" keys. related: vim/vim#10603 closes: vim/vim#16554 https://github.com/vim/vim/commit/e0a2ab397fd13a71efec85b017d5d4d62baf7f63 Cherry-pick tv_dict_has_key() from patch 8.2.4683.
Diffstat (limited to 'test/functional/terminal/buffer_spec.lua')
-rw-r--r--test/functional/terminal/buffer_spec.lua92
1 files changed, 13 insertions, 79 deletions
diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua
index d36dc60a93..4635259e33 100644
--- a/test/functional/terminal/buffer_spec.lua
+++ b/test/functional/terminal/buffer_spec.lua
@@ -557,7 +557,7 @@ describe('terminal input', function()
'--cmd',
'set notermguicolors',
'-c',
- 'while 1 | redraw | echo keytrans(getcharstr()) | endwhile',
+ 'while 1 | redraw | echo keytrans(getcharstr(-1, #{simplify: 0})) | endwhile',
})
screen:expect([[
^ |
@@ -566,7 +566,10 @@ describe('terminal input', function()
|
{3:-- TERMINAL --} |
]])
- for _, key in ipairs({
+ local keys = {
+ '<Tab>',
+ '<CR>',
+ '<Esc>',
'<M-Tab>',
'<M-CR>',
'<M-Esc>',
@@ -632,7 +635,14 @@ describe('terminal input', function()
'<S-ScrollWheelRight>',
'<ScrollWheelLeft>',
'<ScrollWheelRight>',
- }) do
+ }
+ -- FIXME: The escape sequence to enable kitty keyboard mode doesn't work on Windows
+ if not is_os('win') then
+ table.insert(keys, '<C-I>')
+ table.insert(keys, '<C-M>')
+ table.insert(keys, '<C-[>')
+ end
+ for _, key in ipairs(keys) do
feed(key)
screen:expect(([[
|
@@ -643,82 +653,6 @@ describe('terminal input', function()
]]):format(key:gsub('<%d+,%d+>$', '')))
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()
- if
- skip(
- is_os('win'),
- "The escape sequence to enable kitty keyboard mode doesn't work on Windows"
- )
- then
- return
- end
- 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