mirror of
https://github.com/neovim/neovim.git
synced 2025-12-09 16:12:48 +00:00
feat(input): enable <tab>/<c-i>, <cr>/<c-m>, <esc>/<c-[> pairs unconditionally
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user