aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-12-20 05:58:48 +0800
committerGitHub <noreply@github.com>2023-12-20 05:58:48 +0800
commitc95845f3df256c6d0a15e959d2d2133bfe3b2d43 (patch)
tree235ca1c0cf7e0debdadef1ba03d7dcba23f922e4 /src
parenta61d8b615cf99e317fd78a5c9b39aed90908fc51 (diff)
downloadrneovim-c95845f3df256c6d0a15e959d2d2133bfe3b2d43.tar.gz
rneovim-c95845f3df256c6d0a15e959d2d2133bfe3b2d43.tar.bz2
rneovim-c95845f3df256c6d0a15e959d2d2133bfe3b2d43.zip
vim-patch:9.0.2177: Wrong cursor position when dragging out of window (#26661)
Problem: Wrong cursor position when dragging out of window. Solution: Don't use ScreenCols[] when mouse is not in current window. closes: vim/vim#13717 https://github.com/vim/vim/commit/ec14924368e23f2430815c009bd554f88de9c57f
Diffstat (limited to 'src')
-rw-r--r--src/nvim/mouse.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/nvim/mouse.c b/src/nvim/mouse.c
index 7a7b687385..35db717058 100644
--- a/src/nvim/mouse.c
+++ b/src/nvim/mouse.c
@@ -1849,13 +1849,13 @@ static void mouse_check_grid(colnr_T *vcolp, int *flagsp)
int click_col = mouse_col;
// XXX: this doesn't change click_grid if it is 1, even with multigrid
- win_T *wp = mouse_find_win(&click_grid, &click_row, &click_col);
- // Only use vcols[] after the window was redrawn. Mainly matters
- // for tests, a user would not click before redrawing.
- if (wp == NULL || wp->w_redr_type != 0) {
+ if (mouse_find_win(&click_grid, &click_row, &click_col) != curwin
+ // Only use vcols[] after the window was redrawn. Mainly matters
+ // for tests, a user would not click before redrawing.
+ || curwin->w_redr_type != 0) {
return;
}
- ScreenGrid *gp = &wp->w_grid;
+ ScreenGrid *gp = &curwin->w_grid;
int start_row = 0;
int start_col = 0;
grid_adjust(&gp, &start_row, &start_col);
@@ -1891,12 +1891,12 @@ static void mouse_check_grid(colnr_T *vcolp, int *flagsp)
if (eol_vcol < 0) {
// Empty line or whole line before w_leftcol,
// with columns before buffer text
- eol_vcol = wp->w_leftcol - 1;
+ eol_vcol = curwin->w_leftcol - 1;
}
*vcolp = eol_vcol + (int)(off - off_r);
} else {
// Empty line or whole line before w_leftcol
- *vcolp = click_col - start_col + wp->w_leftcol;
+ *vcolp = click_col - start_col + curwin->w_leftcol;
}
} else if (col_from_screen >= 0) {
// Use the virtual column from vcols[], it is accurate also after