1
0
forked from aniani/vim

patch 9.0.1938: multispace wrong when scrolling horizontally

Problem:  multispace wrong when scrolling horizontally
Solution: Update position in "multispace" or "leadmultispace" also in
          skipped chars. Reorder conditions to be more consistent.

closes: #13145
closes: #13147

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
This commit is contained in:
zeertzjq
2023-09-24 23:32:18 +02:00
committed by Christian Brabandt
parent 46a0582ffa
commit abc808112e
4 changed files with 129 additions and 125 deletions

View File

@@ -1684,6 +1684,27 @@ win_line(
cts.cts_vcol += charsize;
prev_ptr = cts.cts_ptr;
MB_PTR_ADV(cts.cts_ptr);
if (wp->w_p_list)
{
in_multispace = *prev_ptr == ' ' && (*cts.cts_ptr == ' '
|| (prev_ptr > line && prev_ptr[-1] == ' '));
if (!in_multispace)
multispace_pos = 0;
else if (cts.cts_ptr >= line + leadcol
&& wp->w_lcs_chars.multispace != NULL)
{
++multispace_pos;
if (wp->w_lcs_chars.multispace[multispace_pos] == NUL)
multispace_pos = 0;
}
else if (cts.cts_ptr < line + leadcol
&& wp->w_lcs_chars.leadmultispace != NULL)
{
++multispace_pos;
if (wp->w_lcs_chars.leadmultispace[multispace_pos] == NUL)
multispace_pos = 0;
}
}
}
wlv.vcol = cts.cts_vcol;
ptr = cts.cts_ptr;
@@ -2589,9 +2610,7 @@ win_line(
#ifdef FEAT_LINEBREAK
int c0;
#endif
#ifdef FEAT_SPELL
char_u *prev_ptr = ptr;
#endif
// Get a character from the line itself.
c = *ptr;
@@ -2941,10 +2960,13 @@ win_line(
}
}
#endif
in_multispace = c == ' '
&& ((ptr > line + 1 && ptr[-2] == ' ') || *ptr == ' ');
if (!in_multispace)
multispace_pos = 0;
if (wp->w_p_list)
{
in_multispace = c == ' ' && (*ptr == ' '
|| (prev_ptr > line && prev_ptr[-1] == ' '));
if (!in_multispace)
multispace_pos = 0;
}
// 'list': Change char 160 to 'nbsp' and space to 'space'
// setting in 'listchars'. But not when the character is