diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-09-21 16:33:09 +0200 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2023-09-21 16:33:09 +0200 |
commit | db54e989b5cff3cc6442dfc500e3962cc1c0b6d0 (patch) | |
tree | f25258b3b57a48831842789bf08f9b0f8bce7d70 /src/mouse.c | |
parent | a7aba6ca5033a85839d997d29d5ca88a1f2acf8f (diff) |
patch 9.0.1923: curswant wrong on click with 've' and 'wrap' setv9.0.1923
Problem: curswant wrong on click with 've' and 'wrap' set
Solution: Add w_leftcol to mouse click column.
closes: #13142
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 | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/mouse.c b/src/mouse.c index ec03673759..f3342f9056 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -2115,11 +2115,16 @@ retnomove: else off_r = off_m - 1; } - col = ScreenCols[off_r] + (off_click - off_r); + colnr_T eol_vcol = ScreenCols[off_r]; + if (eol_vcol < 0) + // Empty line or whole line before w_leftcol, + // with columns before buffer text + eol_vcol = curwin->w_leftcol - 1; + col = eol_vcol + (off_click - off_r); } else - // Clicking on an empty line - col = prev_col - curwin->w_wincol; + // Empty line or whole line before w_leftcol + col = prev_col - curwin->w_wincol + curwin->w_leftcol; } else if (col_from_screen >= 0) { |