aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-07-25 10:15:44 +0800
committerGitHub <noreply@github.com>2022-07-25 10:15:44 +0800
commite9b58a619e1dd7a831138dc14bd8258104724e06 (patch)
treed757afdb3bc7ee8ea52ab1268feaeb60378fe3eb /test
parent46e3e1c7280a409462cceb520fe12259b5ba9937 (diff)
parent0cc41a61d1ac504bae4975021b95ce133268ce1a (diff)
downloadrneovim-e9b58a619e1dd7a831138dc14bd8258104724e06.tar.gz
rneovim-e9b58a619e1dd7a831138dc14bd8258104724e06.tar.bz2
rneovim-e9b58a619e1dd7a831138dc14bd8258104724e06.zip
Merge pull request #18992 from zeertzjq/alt-mouse
fix(input): do no reinterpret mouse keys with ALT modifiers
Diffstat (limited to 'test')
-rw-r--r--test/functional/editor/meta_key_spec.lua2
-rw-r--r--test/functional/terminal/tui_spec.lua7
-rw-r--r--test/functional/ui/mouse_spec.lua12
-rw-r--r--test/functional/ui/statusline_spec.lua48
4 files changed, 48 insertions, 21 deletions
diff --git a/test/functional/editor/meta_key_spec.lua b/test/functional/editor/meta_key_spec.lua
index 23964ca10f..825b20138a 100644
--- a/test/functional/editor/meta_key_spec.lua
+++ b/test/functional/editor/meta_key_spec.lua
@@ -91,7 +91,7 @@ describe('meta-keys #8226 #13042', function()
command('tnoremap <A-j> alt-j')
feed('i<M-l> xxx <A-j>')
eq('meta-l xxx alt-j', exec_lua([[return _G.input_data]]))
- -- Unmapped ALT-chord is sent to terminal as-is. #16220
+ -- Unmapped ALT-chord is sent to terminal as-is. #16202 #16220
exec_lua([[_G.input_data = '']])
command('tunmap <M-l>')
feed('<M-l>')
diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua
index dd88379344..bcd7ae50c8 100644
--- a/test/functional/terminal/tui_spec.lua
+++ b/test/functional/terminal/tui_spec.lua
@@ -436,8 +436,11 @@ describe('TUI', function()
|
{3:-- TERMINAL --} |
]])
- feed_data(':tab split\r:tabnew\r')
- feed_data(':highlight Tabline ctermbg=NONE ctermfg=NONE cterm=underline\r')
+ child_session:request('nvim_command', [[
+ tab split
+ tabnew
+ highlight Tabline ctermbg=NONE ctermfg=NONE cterm=underline
+ ]])
local attrs = screen:get_default_attr_ids()
attrs[11] = {underline = true}
screen:expect([[
diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua
index 7305bd589b..e389b7ab89 100644
--- a/test/functional/ui/mouse_spec.lua
+++ b/test/functional/ui/mouse_spec.lua
@@ -1572,23 +1572,17 @@ describe('ui/mouse/input', function()
meths.input_mouse('left', 'release', '', 0, 0, 0)
end)
- it('scroll keys are not translated into multiclicks #6211 #6989', function()
+ it('scroll keys are not translated into multiclicks and can be mapped #6211 #6989', function()
meths.set_var('mouse_up', 0)
meths.set_var('mouse_up2', 0)
- meths.set_var('mouse_up3', 0)
- meths.set_var('mouse_up4', 0)
command('nnoremap <ScrollWheelUp> <Cmd>let g:mouse_up += 1<CR>')
command('nnoremap <2-ScrollWheelUp> <Cmd>let g:mouse_up2 += 1<CR>')
- command('nnoremap <3-ScrollWheelUp> <Cmd>let g:mouse_up3 += 1<CR>')
- command('nnoremap <4-ScrollWheelUp> <Cmd>let g:mouse_up4 += 1<CR>')
- meths.input_mouse('wheel', 'up', '', 0, 0, 0)
- meths.input_mouse('wheel', 'up', '', 0, 0, 0)
+ feed('<ScrollWheelUp><0,0>')
+ feed('<ScrollWheelUp><0,0>')
meths.input_mouse('wheel', 'up', '', 0, 0, 0)
meths.input_mouse('wheel', 'up', '', 0, 0, 0)
eq(4, meths.get_var('mouse_up'))
eq(0, meths.get_var('mouse_up2'))
- eq(0, meths.get_var('mouse_up3'))
- eq(0, meths.get_var('mouse_up4'))
end)
it('feeding <MouseMove> does not use uninitialized memory #19480', function()
diff --git a/test/functional/ui/statusline_spec.lua b/test/functional/ui/statusline_spec.lua
index 760760150c..69a2d2f4ed 100644
--- a/test/functional/ui/statusline_spec.lua
+++ b/test/functional/ui/statusline_spec.lua
@@ -21,11 +21,9 @@ describe('statusline clicks', function()
command('set laststatus=2 mousemodel=extend')
exec([=[
function! MyClickFunc(minwid, clicks, button, mods)
- let mods = trim(a:mods)
- if mods ==# ''
- let g:testvar = printf("%d %d %s", a:minwid, a:clicks, a:button)
- else
- let g:testvar = printf("%d %d %s %s", a:minwid, a:clicks, a:button, mods)
+ let g:testvar = printf("%d %d %s", a:minwid, a:clicks, a:button)
+ if a:mods !=# ' '
+ let g:testvar ..= '(' .. a:mods .. ')'
endif
endfunction
]=])
@@ -35,8 +33,20 @@ describe('statusline clicks', function()
meths.set_option('statusline', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T')
meths.input_mouse('left', 'press', '', 0, 6, 17)
eq('0 1 l', eval("g:testvar"))
+ meths.input_mouse('left', 'press', '', 0, 6, 17)
+ eq('0 2 l', eval("g:testvar"))
+ meths.input_mouse('left', 'press', '', 0, 6, 17)
+ eq('0 3 l', eval("g:testvar"))
+ meths.input_mouse('left', 'press', '', 0, 6, 17)
+ eq('0 4 l', eval("g:testvar"))
meths.input_mouse('right', 'press', '', 0, 6, 17)
eq('0 1 r', eval("g:testvar"))
+ meths.input_mouse('right', 'press', '', 0, 6, 17)
+ eq('0 2 r', eval("g:testvar"))
+ meths.input_mouse('right', 'press', '', 0, 6, 17)
+ eq('0 3 r', eval("g:testvar"))
+ meths.input_mouse('right', 'press', '', 0, 6, 17)
+ eq('0 4 r', eval("g:testvar"))
end)
it('works for winbar', function()
@@ -101,10 +111,30 @@ describe('statusline clicks', function()
it("works with modifiers #18994", function()
meths.set_option('statusline', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T')
- meths.input_mouse('right', 'press', 's', 0, 6, 17)
- eq('0 1 r s', eval("g:testvar"))
- meths.input_mouse('left', 'press', 's', 0, 6, 17)
- eq('0 1 l s', eval("g:testvar"))
+ -- Note: alternate between left and right mouse buttons to avoid triggering multiclicks
+ meths.input_mouse('left', 'press', 'S', 0, 6, 17)
+ eq('0 1 l(s )', eval("g:testvar"))
+ meths.input_mouse('right', 'press', 'S', 0, 6, 17)
+ eq('0 1 r(s )', eval("g:testvar"))
+ meths.input_mouse('left', 'press', 'A', 0, 6, 17)
+ eq('0 1 l( a )', eval("g:testvar"))
+ meths.input_mouse('right', 'press', 'A', 0, 6, 17)
+ eq('0 1 r( a )', eval("g:testvar"))
+ meths.input_mouse('left', 'press', 'AS', 0, 6, 17)
+ eq('0 1 l(s a )', eval("g:testvar"))
+ meths.input_mouse('right', 'press', 'AS', 0, 6, 17)
+ eq('0 1 r(s a )', eval("g:testvar"))
+ meths.input_mouse('left', 'press', 'T', 0, 6, 17)
+ eq('0 1 l( m)', eval("g:testvar"))
+ meths.input_mouse('right', 'press', 'T', 0, 6, 17)
+ eq('0 1 r( m)', eval("g:testvar"))
+ meths.input_mouse('left', 'press', 'TS', 0, 6, 17)
+ eq('0 1 l(s m)', eval("g:testvar"))
+ meths.input_mouse('right', 'press', 'TS', 0, 6, 17)
+ eq('0 1 r(s m)', eval("g:testvar"))
+ meths.input_mouse('left', 'press', 'C', 0, 6, 17)
+ eq('0 1 l( c )', eval("g:testvar"))
+ -- <C-RightMouse> is for tag jump
end)
it("works for global statusline with vertical splits #19186", function()