fix(mouse): early return when clicking in padded 'statuscolumn' (#29394)

Problem:  Hit assert when clicking inside a padded 'statuscolumn' that
          is padded beyond the length of the allocated click_defs.
Solution: Still consider this a "in_statuscol" click, but return early
          when about to execute the click func.
This commit is contained in:
luukvbaal authored and GitHub committed 2024-06-19 06:00:39 +08:00
1 parent 2791fd4e17
commit 102971a396
2 files changed
+7

No files matched your search

+3
View File
@@ -688,6 +688,9 @@ popupexit:
if (in_statuscol && wp->w_p_rl) {
click_col = wp->w_width_inner - click_col - 1;
}
if (in_statuscol && click_col >= (int)wp->w_statuscol_click_defs_size) {
return false;
}
if (click_defs != NULL) {
switch (click_defs[click_col].type) {
+4
View File
@@ -91,6 +91,10 @@ describe('statuscolumn', function()
{8:2 }aaaaa |
|
]])
-- Doesn't crash when clicking inside padded area without click_defs
command('set numberwidth=10')
api.nvim_input_mouse('left', 'press', '', 0, 0, 5)
assert_alive()
end)
it("works with 'number' and 'relativenumber'", function()