aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/input_spec.lua
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-03-23 11:58:47 +0100
committerbfredl <bjorn.linse@gmail.com>2022-03-24 11:02:39 +0100
commited88ca75034a48916d165e88459c791c450df550 (patch)
treefcb649f147d87f1878cc20cc5260840f05efdbad /test/functional/ui/input_spec.lua
parentd7488bf38677b5d6b1df3a88e45b3d2f21527eb4 (diff)
downloadrneovim-ed88ca75034a48916d165e88459c791c450df550.tar.gz
rneovim-ed88ca75034a48916d165e88459c791c450df550.tar.bz2
rneovim-ed88ca75034a48916d165e88459c791c450df550.zip
feat(input): enable <tab>/<c-i>, <cr>/<c-m>, <esc>/<c-[> pairs unconditionally
Diffstat (limited to 'test/functional/ui/input_spec.lua')
-rw-r--r--test/functional/ui/input_spec.lua45
1 files changed, 45 insertions, 0 deletions
diff --git a/test/functional/ui/input_spec.lua b/test/functional/ui/input_spec.lua
index 7000505909..f5ae228b1e 100644
--- a/test/functional/ui/input_spec.lua
+++ b/test/functional/ui/input_spec.lua
@@ -3,6 +3,7 @@ local clear, feed_command = helpers.clear, helpers.feed_command
local feed, next_msg, eq = helpers.feed, helpers.next_msg, helpers.eq
local command = helpers.command
local expect = helpers.expect
+local curbuf_contents = helpers.curbuf_contents
local meths = helpers.meths
local exec_lua = helpers.exec_lua
local write_file = helpers.write_file
@@ -159,6 +160,50 @@ describe('input split utf sequences', function()
end)
end)
+describe('input pairs', function()
+ describe('<tab> / <c-i>', function()
+ it('ok', function()
+ feed('i<tab><c-i><esc>')
+ eq('\t\t', curbuf_contents())
+ end)
+
+ it('can be mapped', function()
+ command('inoremap <tab> TAB!')
+ command('inoremap <c-i> CTRL-I!')
+ feed('i<tab><c-i><esc>')
+ eq('TAB!CTRL-I!', curbuf_contents())
+ end)
+ end)
+
+ describe('<cr> / <c-m>', function()
+ it('ok', function()
+ feed('iunos<c-m>dos<cr>tres<esc>')
+ eq('unos\ndos\ntres', curbuf_contents())
+ end)
+
+ it('can be mapped', function()
+ command('inoremap <c-m> SNIPPET!')
+ command('inoremap <cr> , and then<cr>')
+ feed('iunos<c-m>dos<cr>tres<esc>')
+ eq('unosSNIPPET!dos, and then\ntres', curbuf_contents())
+ end)
+ end)
+
+ describe('<esc> / <c-[>', function()
+ it('ok', function()
+ feed('2adouble<c-[>asingle<esc>')
+ eq('doubledoublesingle', curbuf_contents())
+ end)
+
+ it('can be mapped', function()
+ command('inoremap <c-[> HALLOJ!')
+ command('inoremap <esc> ,<esc>')
+ feed('2adubbel<c-[>upp<esc>')
+ eq('dubbelHALLOJ!upp,dubbelHALLOJ!upp,', curbuf_contents())
+ end)
+ end)
+end)
+
describe('input non-printable chars', function()
after_each(function()
os.remove('Xtest-overwrite')