Mercurial > vim
comparison src/mouse.c @ 33316:a2dfcbbfc301 v9.0.1923
patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Commit: https://github.com/vim/vim/commit/db54e989b5cff3cc6442dfc500e3962cc1c0b6d0
Author: zeertzjq <zeertzjq@outlook.com>
Date: Thu Sep 21 16:33:09 2023 +0200
patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
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>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 21 Sep 2023 16:45:04 +0200 |
parents | cb447202030d |
children | bfe07ef45143 |
comparison
equal
deleted
inserted
replaced
33315:d198db604bcf | 33316:a2dfcbbfc301 |
---|---|
2113 if (ScreenCols[off_m] < MAXCOL) | 2113 if (ScreenCols[off_m] < MAXCOL) |
2114 off_l = off_m; | 2114 off_l = off_m; |
2115 else | 2115 else |
2116 off_r = off_m - 1; | 2116 off_r = off_m - 1; |
2117 } | 2117 } |
2118 col = ScreenCols[off_r] + (off_click - off_r); | 2118 colnr_T eol_vcol = ScreenCols[off_r]; |
2119 if (eol_vcol < 0) | |
2120 // Empty line or whole line before w_leftcol, | |
2121 // with columns before buffer text | |
2122 eol_vcol = curwin->w_leftcol - 1; | |
2123 col = eol_vcol + (off_click - off_r); | |
2119 } | 2124 } |
2120 else | 2125 else |
2121 // Clicking on an empty line | 2126 // Empty line or whole line before w_leftcol |
2122 col = prev_col - curwin->w_wincol; | 2127 col = prev_col - curwin->w_wincol + curwin->w_leftcol; |
2123 } | 2128 } |
2124 else if (col_from_screen >= 0) | 2129 else if (col_from_screen >= 0) |
2125 { | 2130 { |
2126 // Use the virtual column from ScreenCols[], it is accurate also after | 2131 // Use the virtual column from ScreenCols[], it is accurate also after |
2127 // concealed characters. | 2132 // concealed characters. |