diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-09-20 20:08:40 +0200 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2023-09-20 20:08:40 +0200 |
commit | 03cd697d635f1b0e7ffe21cf8244a8fb755f2ddb (patch) | |
tree | d856a22b0fc6373c66b20b182705ac14cc767c49 /src/mouse.c | |
parent | 5790a54166793554d16f6a85d8824632860b8b37 (diff) |
patch 9.0.1919: Wrong curswant when clicking on empty line or with vsplitsv9.0.1919
Problem: Wrong curswant when clicking on empty line or with vsplits.
Solution: Don't check for ScreenCols[] before the start of the window
and handle empty line properly.
closes: #13132
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Diffstat (limited to 'src/mouse.c')
-rw-r--r-- | src/mouse.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mouse.c b/src/mouse.c index aa06e6cb50..ec03673759 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -2101,11 +2101,11 @@ retnomove: if (col_from_screen == MAXCOL) { // When clicking after end of line, still need to set correct curswant - int off_l = LineOffset[prev_row]; + int off_l = LineOffset[prev_row] + curwin->w_wincol; if (ScreenCols[off_l] < MAXCOL) { // Binary search to find last char in line - int off_r = off_l + prev_col; + int off_r = LineOffset[prev_row] + prev_col; int off_click = off_r; while (off_l < off_r) { @@ -2118,8 +2118,8 @@ retnomove: col = ScreenCols[off_r] + (off_click - off_r); } else - // Shouldn't normally happen - col = MAXCOL; + // Clicking on an empty line + col = prev_col - curwin->w_wincol; } else if (col_from_screen >= 0) { |