fix(mouse): indicate X1 and X2 button clicks on statusline (#30655)

This commit is contained in:
zeertzjq 2024-10-04 21:31:28 +08:00 committed by GitHub
parent 305012ea07
commit 86c5c8724b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 1 deletions

View File

@ -194,7 +194,11 @@ static void call_click_def_func(StlClickDefinition *click_defs, int col, int whi
? "r"
: (which_button == MOUSE_MIDDLE
? "m"
: "?")))
: (which_button == MOUSE_X1
? "x1"
: (which_button == MOUSE_X2
? "x2"
: "?")))))
},
},
{

View File

@ -63,6 +63,22 @@ for _, model in ipairs(mousemodels) do
eq('0 3 r', eval('g:testvar'))
api.nvim_input_mouse('right', 'press', '', 0, 6, 28)
eq('0 4 r', eval('g:testvar'))
api.nvim_input_mouse('x1', 'press', '', 0, 6, 17)
eq('0 1 x1', eval('g:testvar'))
api.nvim_input_mouse('x1', 'press', '', 0, 6, 17)
eq('0 2 x1', eval('g:testvar'))
api.nvim_input_mouse('x1', 'press', '', 0, 6, 17)
eq('0 3 x1', eval('g:testvar'))
api.nvim_input_mouse('x1', 'press', '', 0, 6, 17)
eq('0 4 x1', eval('g:testvar'))
api.nvim_input_mouse('x2', 'press', '', 0, 6, 28)
eq('0 1 x2', eval('g:testvar'))
api.nvim_input_mouse('x2', 'press', '', 0, 6, 28)
eq('0 2 x2', eval('g:testvar'))
api.nvim_input_mouse('x2', 'press', '', 0, 6, 28)
eq('0 3 x2', eval('g:testvar'))
api.nvim_input_mouse('x2', 'press', '', 0, 6, 28)
eq('0 4 x2', eval('g:testvar'))
end)
it('works with control characters and highlight', function()