aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/terminal.c
diff options
context:
space:
mode:
authorerw7 <erw7.github@gmail.com>2020-04-21 22:44:39 +0900
committerGitHub <noreply@github.com>2020-04-21 15:44:39 +0200
commit68546805790b5fd50e5e520a42dcf2e68c8fa4de (patch)
tree37371a615c2438e93ec081dcfb2dfc1640a35080 /src/nvim/terminal.c
parent633322a020b0253aeb8c6eaeeed17d8a8fb53229 (diff)
downloadrneovim-68546805790b5fd50e5e520a42dcf2e68c8fa4de.tar.gz
rneovim-68546805790b5fd50e5e520a42dcf2e68c8fa4de.tar.bz2
rneovim-68546805790b5fd50e5e520a42dcf2e68c8fa4de.zip
terminal: Fix mouse coordinates issue (#12158)
Offsets of window were not taken into account when sending mouse coordinates to the terminal. Therefore, when nu or rnu is set, the mouse coordinates sent to the terminal were not correct. Change it to send the correct coordinates by subtract window offset from col.
Diffstat (limited to 'src/nvim/terminal.c')
-rw-r--r--src/nvim/terminal.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c
index c5e756905a..a37cc60928 100644
--- a/src/nvim/terminal.c
+++ b/src/nvim/terminal.c
@@ -992,8 +992,9 @@ static void mouse_action(Terminal *term, int button, int row, int col,
static bool send_mouse_event(Terminal *term, int c)
{
int row = mouse_row, col = mouse_col, grid = mouse_grid;
+ int offset;
win_T *mouse_win = mouse_find_win(&grid, &row, &col);
- if (mouse_win == NULL) {
+ if (mouse_win == NULL || (offset = win_col_off(mouse_win)) > col) {
goto end;
}
@@ -1015,7 +1016,7 @@ static bool send_mouse_event(Terminal *term, int c)
default: return false;
}
- mouse_action(term, button, row, col, drag, 0);
+ mouse_action(term, button, row, col - offset, drag, 0);
size_t len = vterm_output_read(term->vt, term->textbuf,
sizeof(term->textbuf));
terminal_send(term, term->textbuf, (size_t)len);