fix: do not save K_EVENT as lastc in Insert mode

I'm also gonna move some other K_EVENT-related tests to vim_spec.lua
This commit is contained in:
zeertzjq
2021-12-26 15:23:39 +08:00
parent 9dd8557921
commit ab1ceaaaa9
4 changed files with 40 additions and 43 deletions

View File

@@ -1154,8 +1154,8 @@ describe('API', function()
end)
end)
describe('RPC (K_EVENT) #6166', function()
it('does not complete ("interrupt") normal-mode operator-pending', function()
describe('RPC (K_EVENT)', function()
it('does not complete ("interrupt") normal-mode operator-pending #6166', function()
helpers.insert([[
FIRST LINE
SECOND LINE]])
@@ -1191,7 +1191,7 @@ describe('API', function()
]])
end)
it('does not complete ("interrupt") normal-mode map-pending', function()
it('does not complete ("interrupt") normal-mode map-pending #6166', function()
command("nnoremap dd :let g:foo='it worked...'<CR>")
helpers.insert([[
FIRST LINE
@@ -1207,7 +1207,8 @@ describe('API', function()
SECOND LINE]])
eq('it worked...', helpers.eval('g:foo'))
end)
it('does not complete ("interrupt") insert-mode map-pending', function()
it('does not complete ("interrupt") insert-mode map-pending #6166', function()
command('inoremap xx foo')
command('set timeoutlen=9999')
helpers.insert([[
@@ -1222,6 +1223,37 @@ describe('API', function()
FIRST LINE
SECOND LINfooE]])
end)
it('does not interrupt Insert mode i_CTRL-O #10035', function()
feed('iHello World<c-o>')
eq({mode='niI', blocking=false}, meths.get_mode()) -- fast event
eq(2, eval('1+1')) -- causes K_EVENT key
eq({mode='niI', blocking=false}, meths.get_mode()) -- still in ctrl-o mode
feed('dd')
eq({mode='i', blocking=false}, meths.get_mode()) -- left ctrl-o mode
expect('') -- executed the command
end)
it('does not interrupt Select mode v_CTRL-O #15688', function()
feed('iHello World<esc>gh<c-o>')
eq({mode='vs', blocking=false}, meths.get_mode()) -- fast event
eq({mode='vs', blocking=false}, meths.get_mode()) -- again #15288
eq(2, eval('1+1')) -- causes K_EVENT key
eq({mode='vs', blocking=false}, meths.get_mode()) -- still in ctrl-o mode
feed('^')
eq({mode='s', blocking=false}, meths.get_mode()) -- left ctrl-o mode
feed('h')
eq({mode='i', blocking=false}, meths.get_mode()) -- entered insert mode
expect('h') -- selection is the whole line and is replaced
end)
it('does not interrupt Insert mode i_0_CTRL-D #13997', function()
command('set timeoutlen=9999')
feed('i<Tab><Tab>a0')
eq(2, eval('1+1')) -- causes K_EVENT key
feed('<C-D>')
expect('a') -- recognized i_0_CTRL-D
end)
end)
describe('nvim_get_context', function()