Merge pull request #18624 from famiu/feat/ui/winbar

fix(ui): set correct position on mouse click when 'winbar' is enabled
This commit is contained in:
bfredl 2022-05-18 19:55:01 +02:00 committed by GitHub
commit b840b5b6a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View File

@ -406,6 +406,9 @@ bool mouse_comp_pos(win_T *win, int *rowp, int *colp, linenr_T *lnump)
if (win->w_p_rl) { if (win->w_p_rl) {
col = win->w_width_inner - 1 - col; col = win->w_width_inner - 1 - col;
} }
if (win->w_winbar_height) {
row -= win->w_winbar_height;
}
lnum = win->w_topline; lnum = win->w_topline;

View File

@ -2,6 +2,9 @@ local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen') local Screen = require('test.functional.ui.screen')
local clear = helpers.clear local clear = helpers.clear
local command = helpers.command local command = helpers.command
local insert = helpers.insert
local meths = helpers.meths
local eq = helpers.eq
describe('winbar', function() describe('winbar', function()
local screen local screen
@ -177,4 +180,18 @@ describe('winbar', function()
| |
]]) ]])
end) end)
it('sets correct position on mouse click', function()
insert[[
line 1
line 2
line 3
line 4
line -42
line i
line sin(theta)
line 8
]]
meths.input_mouse('left', 'press', '', 0, 5, 1)
eq({5, 1}, meths.win_get_cursor(0))
end)
end) end)