diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-08-17 22:35:26 +0200 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2023-08-17 22:35:26 +0200 |
commit | e500ae8e29ad921378085f5d70ee5c0c537be1ba (patch) | |
tree | b0359471c2dd4bb6920edc9b98107e3730eff8a9 /src/drawline.c | |
parent | 2261c89a49ff2115e1ccc9ab9211e9f0d5a37578 (diff) |
patch 9.0.1725: cursor pos wrong after concealed text with 'virtualedit'v9.0.1725
Problem: Wrong cursor position when clicking after concealed text
with 'virtualedit'.
Solution: Store virtual columns in ScreenCols[] instead of text
columns, and always use coladvance() when clicking.
This also fixes incorrect curswant when clicking on a TAB, so now
Test_normal_click_on_ctrl_char() asserts the same results as the ones
before patch 9.0.0048.
closes: #12808
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Diffstat (limited to 'src/drawline.c')
-rw-r--r-- | src/drawline.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/drawline.c b/src/drawline.c index ef9f663715..18ae4bf768 100644 --- a/src/drawline.c +++ b/src/drawline.c @@ -1829,7 +1829,6 @@ win_line( win_line_start(wp, &wlv, FALSE); - char_u *prev_ptr = ptr; // Repeat for the whole displayed line. for (;;) { @@ -2261,9 +2260,9 @@ win_line( } #endif +#ifdef FEAT_SEARCH_EXTRA if (wlv.n_extra == 0) { -#ifdef FEAT_SEARCH_EXTRA // Check for start/end of 'hlsearch' and other matches. // After end, check for start/end of next match. // When another match, have to check for start again. @@ -2278,10 +2277,8 @@ win_line( // and bad things happen. if (*ptr == NUL) has_match_conc = 0; -#endif - - prev_ptr = ptr; } +#endif #ifdef FEAT_DIFF if (wlv.diff_hlf != (hlf_T)0) @@ -2356,7 +2353,6 @@ win_line( // have made it invalid. line = ml_get_buf(wp->w_buffer, lnum, FALSE); ptr = line + v; - prev_ptr = ptr; # ifdef FEAT_CONCEAL // no concealing past the end of the line, it interferes // with line highlighting @@ -2567,7 +2563,9 @@ win_line( #ifdef FEAT_LINEBREAK int c0; #endif - prev_ptr = ptr; +#ifdef FEAT_SPELL + char_u *prev_ptr = ptr; +#endif // Get a character from the line itself. c = *ptr; @@ -3809,7 +3807,7 @@ win_line( else ScreenAttrs[wlv.off] = wlv.char_attr; - ScreenCols[wlv.off] = (colnr_T)(prev_ptr - line); + ScreenCols[wlv.off] = wlv.vcol; if (has_mbyte && (*mb_char2cells)(mb_c) > 1) { @@ -3833,7 +3831,7 @@ win_line( if (wlv.tocol == wlv.vcol) ++wlv.tocol; - ScreenCols[wlv.off] = (colnr_T)(prev_ptr - line); + ScreenCols[wlv.off] = wlv.vcol; #ifdef FEAT_RIGHTLEFT if (wp->w_p_rl) |