diff options
author | luukvbaal <luukvbaal@gmail.com> | 2023-04-18 02:00:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-18 08:00:49 +0800 |
commit | 84a4319545ad280d48a41e4cafaf0622c4278a16 (patch) | |
tree | 839550c90de8f87431b26314b818ecbce0786ec4 | |
parent | ab1edecfb7c73c82c2d5886cb8e270b44aca7d01 (diff) | |
download | rneovim-84a4319545ad280d48a41e4cafaf0622c4278a16.tar.gz rneovim-84a4319545ad280d48a41e4cafaf0622c4278a16.tar.bz2 rneovim-84a4319545ad280d48a41e4cafaf0622c4278a16.zip |
fix(mouse): cmdline click registered as statuscolumn (#23163)
-rw-r--r-- | src/nvim/mouse.c | 7 | ||||
-rw-r--r-- | test/functional/ui/statuscolumn_spec.lua | 3 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/nvim/mouse.c b/src/nvim/mouse.c index 95fe4d70d3..28b40994a1 100644 --- a/src/nvim/mouse.c +++ b/src/nvim/mouse.c @@ -1097,7 +1097,8 @@ retnomove: return IN_UNKNOWN; } - on_status_line = (grid == DEFAULT_GRID_HANDLE && row + wp->w_winbar_height >= wp->w_height) + bool below_window = grid == DEFAULT_GRID_HANDLE && row + wp->w_winbar_height >= wp->w_height; + on_status_line = (below_window) ? row + wp->w_winbar_height - wp->w_height + 1 == 1 : false; @@ -1105,7 +1106,7 @@ retnomove: ? wp->w_winbar_height != 0 : false; - on_statuscol = !on_status_line && !on_winbar && col < win_col_off(wp) + on_statuscol = !below_window && !on_status_line && !on_winbar && col < win_col_off(wp) ? *wp->w_p_stc != NUL : false; @@ -1144,7 +1145,7 @@ retnomove: dragwin = NULL; // winpos and height may change in win_enter()! - if (grid == DEFAULT_GRID_HANDLE && row + wp->w_winbar_height >= wp->w_height) { + if (below_window) { // In (or below) status line status_line_offset = row + wp->w_winbar_height - wp->w_height + 1; dragwin = wp; diff --git a/test/functional/ui/statuscolumn_spec.lua b/test/functional/ui/statuscolumn_spec.lua index a2fe875e65..0eec693182 100644 --- a/test/functional/ui/statuscolumn_spec.lua +++ b/test/functional/ui/statuscolumn_spec.lua @@ -457,6 +457,9 @@ describe('statuscolumn', function() -- Check that statusline click doesn't register as statuscolumn click meths.input_mouse('right', 'press', '', 0, 12, 0) eq('', eval("g:testvar")) + -- Check that cmdline click doesn't register as statuscolumn click + meths.input_mouse('right', 'press', '', 0, 13, 0) + eq('', eval("g:testvar")) end) it('click labels do not leak memory', function() |