mirror of
https://github.com/neovim/neovim.git
synced 2025-12-16 03:15:39 +00:00
vim-patch:8.2.{4692,4691,4690}: fix Insert mode <LeftDrag> mapping bug (#17999)
vim-patch:8.2.4692: no test for what 8.2.4691 fixes Problem: No test for what 8.2.4691 fixes. Solution: Add a test. Use a more generic sotlution. (closes vim/vim#10090)0f68e6c07aTest cannot be used because it must use test_setmouse(). Use a Lua test. Reverted patches: vim-patch:8.2.4691: solution for <Cmd> in a mapping causes trouble Problem: Solution for <Cmd> in a mapping causes trouble. Solution: Use another solution: put back CTRL-O after reading the <Cmd> sequence.ca9d8d2cb9vim-patch:8.2.4689: using <Cmd> in a mapping does not work for mouse keys Problem: Using <Cmd> in a mapping does not work for mouse keys in Insert mode. (Sergey Vlasov) Solution: When reading the <Cmd> argument do not use the stuff buffer. (closes vim/vim#10080)d0fb2d8041
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
local helpers = require('test.functional.helpers')(after_each)
|
||||
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
|
||||
local feed_command, expect, poke_eventloop = helpers.feed_command, helpers.expect, helpers.poke_eventloop
|
||||
local command, eq, eval, meths = helpers.command, helpers.eq, helpers.eval, helpers.meths
|
||||
local sleep = helpers.sleep
|
||||
|
||||
describe('mapping', function()
|
||||
before_each(clear)
|
||||
@@ -126,4 +128,28 @@ describe('mapping', function()
|
||||
new line here
|
||||
]])
|
||||
end)
|
||||
|
||||
it('<LeftDrag> mapping in Insert mode works correctly vim-patch:8.2.4692', function()
|
||||
command('set mouse=a')
|
||||
|
||||
command([[inoremap <LeftDrag> <LeftDrag><Cmd>let g:dragged = 1<CR>]])
|
||||
feed('i')
|
||||
sleep(10)
|
||||
meths.input_mouse('left', 'press', '', 0, 0, 0)
|
||||
sleep(10)
|
||||
meths.input_mouse('left', 'drag', '', 0, 0, 1)
|
||||
sleep(10)
|
||||
eq(1, eval('g:dragged'))
|
||||
eq('v', eval('mode()'))
|
||||
feed([[<C-\><C-N>]])
|
||||
|
||||
command([[inoremap <LeftDrag> <LeftDrag><C-\><C-N>]])
|
||||
feed('i')
|
||||
sleep(10)
|
||||
meths.input_mouse('left', 'press', '', 0, 0, 0)
|
||||
sleep(10)
|
||||
meths.input_mouse('left', 'drag', '', 0, 0, 1)
|
||||
sleep(10)
|
||||
eq('n', eval('mode()'))
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user