diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-01-05 10:59:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-05 10:59:52 +0800 |
commit | e09adfdcffe8a94e09d834bb49f42fd725ddd47b (patch) | |
tree | 40903eb61c91c191e18fea2e28d2620f69b498b0 /src | |
parent | dab584408211a39962a7313b7b8c4cb7e3717a7a (diff) | |
download | rneovim-e09adfdcffe8a94e09d834bb49f42fd725ddd47b.tar.gz rneovim-e09adfdcffe8a94e09d834bb49f42fd725ddd47b.tar.bz2 rneovim-e09adfdcffe8a94e09d834bb49f42fd725ddd47b.zip |
fix(terminal): check if mouse on statusline/tabline/winbar/vsep (#26892)
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/mouse.c | 4 | ||||
-rw-r--r-- | src/nvim/terminal.c | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/nvim/mouse.c b/src/nvim/mouse.c index 7405c8c38b..eeec4e4cd9 100644 --- a/src/nvim/mouse.c +++ b/src/nvim/mouse.c @@ -229,7 +229,7 @@ static int get_fpos_of_mouse(pos_T *mpos) return IN_STATUS_LINE; } - if (winrow == -1 && wp->w_winbar_height != 0) { + if (winrow < 0 && winrow + wp->w_winbar_height >= 0) { return MOUSE_WINBAR; } @@ -1249,7 +1249,7 @@ retnomove: 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; on_sep_line = grid == DEFAULT_GRID_HANDLE && col >= wp->w_width && col - wp->w_width + 1 == 1; - on_winbar = row == -1 && wp->w_winbar_height != 0; + on_winbar = row < 0 && row + wp->w_winbar_height >= 0; on_statuscol = !below_window && !on_status_line && !on_sep_line && !on_winbar && *wp->w_p_stc != NUL && (wp->w_p_rl diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index dda629ac27..c6a2cb3354 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -1437,8 +1437,10 @@ static bool send_mouse_event(Terminal *term, int c) } int offset; - if (term->forward_mouse && mouse_win->w_buffer->terminal == term - && col >= (offset = win_col_off(mouse_win))) { + if (term->forward_mouse && mouse_win->w_buffer->terminal == term && row >= 0 + && (grid > 1 || row + mouse_win->w_winbar_height < mouse_win->w_height) + && col >= (offset = win_col_off(mouse_win)) + && (grid > 1 || col < mouse_win->w_width)) { // event in the terminal window and mouse events was enabled by the // program. translate and forward the event int button; |