1
0
forked from aniani/vim

patch 9.0.1725: cursor pos wrong after concealed text with 'virtualedit'

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>
This commit is contained in:
zeertzjq
2023-08-17 22:35:26 +02:00
committed by Christian Brabandt
parent 2261c89a49
commit e500ae8e29
7 changed files with 102 additions and 44 deletions

View File

@@ -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)