mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
Merge pull request #17961 from zeertzjq/scroll-no-multiclick
fix(input): do not translate scroll keys into multiclicks
This commit is contained in:
@@ -288,8 +288,13 @@ static uint8_t check_multiclick(int code, int grid, int row, int col)
|
||||
static int orig_mouse_row = 0;
|
||||
static uint64_t orig_mouse_time = 0; // time of previous mouse click
|
||||
|
||||
if (code == KE_LEFTRELEASE || code == KE_RIGHTRELEASE
|
||||
|| code == KE_MIDDLERELEASE) {
|
||||
if (code == KE_LEFTRELEASE
|
||||
|| code == KE_RIGHTRELEASE
|
||||
|| code == KE_MIDDLERELEASE
|
||||
|| code == KE_MOUSEDOWN
|
||||
|| code == KE_MOUSEUP
|
||||
|| code == KE_MOUSELEFT
|
||||
|| code == KE_MOUSERIGHT) {
|
||||
return 0;
|
||||
}
|
||||
uint64_t mouse_time = os_hrtime(); // time of current mouse click (ns)
|
||||
|
@@ -1571,4 +1571,23 @@ describe('ui/mouse/input', function()
|
||||
meths.set_option('winwidth', winwidth)
|
||||
meths.input_mouse('left', 'release', '', 0, 0, 0)
|
||||
end)
|
||||
|
||||
it('scroll keys are not translated into multiclicks #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)
|
||||
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)
|
||||
end)
|
||||
|
Reference in New Issue
Block a user