mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 14:08:32 +00:00
fix(mouse): click on global statusline with splits (#19390)
This commit is contained in:
@@ -1908,6 +1908,13 @@ bool do_mouse(oparg_T *oap, int c, int dir, long count, bool fixindent)
|
||||
StlClickDefinition *click_defs = in_status_line ? wp->w_status_click_defs
|
||||
: wp->w_winbar_click_defs;
|
||||
|
||||
if (in_status_line && global_stl_height() > 0) {
|
||||
// global statusline is displayed for the current window,
|
||||
// and spans the whole screen.
|
||||
click_defs = curwin->w_status_click_defs;
|
||||
click_col = mouse_col;
|
||||
}
|
||||
|
||||
if (click_defs != NULL) {
|
||||
switch (click_defs[click_col].type) {
|
||||
case kStlClickDisabled:
|
||||
|
@@ -98,13 +98,41 @@ describe('statusline clicks', function()
|
||||
eq('0 2 r', eval("g:testvar"))
|
||||
end)
|
||||
|
||||
it("click works with modifiers #18994", 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"))
|
||||
end)
|
||||
|
||||
it("works for global statusline with vertical splits #19186", function()
|
||||
command('set laststatus=3')
|
||||
meths.set_option('statusline', '%0@MyClickFunc@Clicky stuff%T %= %0@MyClickFunc@Clicky stuff%T')
|
||||
command('vsplit')
|
||||
screen:expect([[
|
||||
^ │ |
|
||||
~ │~ |
|
||||
~ │~ |
|
||||
~ │~ |
|
||||
~ │~ |
|
||||
~ │~ |
|
||||
Clicky stuff Clicky stuff|
|
||||
|
|
||||
]])
|
||||
|
||||
-- clickable area on the right
|
||||
meths.input_mouse('left', 'press', '', 0, 6, 35)
|
||||
eq('0 1 l', eval("g:testvar"))
|
||||
meths.input_mouse('right', 'press', '', 0, 6, 35)
|
||||
eq('0 1 r', eval("g:testvar"))
|
||||
|
||||
-- clickable area on the left
|
||||
meths.input_mouse('left', 'press', '', 0, 6, 5)
|
||||
eq('0 1 l', eval("g:testvar"))
|
||||
meths.input_mouse('right', 'press', '', 0, 6, 5)
|
||||
eq('0 1 r', eval("g:testvar"))
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('global statusline', function()
|
||||
|
Reference in New Issue
Block a user