diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-09-24 23:32:18 +0200 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2023-09-24 23:32:18 +0200 |
commit | abc808112ee5df58a9f612f2bb5a65389c2c14e1 (patch) | |
tree | 2af294f535b972a9da4430e3b56a82fbc1714878 /src/drawline.c | |
parent | 46a0582ffa4ea79b112ac01e25adccf93b49cd9d (diff) |
patch 9.0.1938: multispace wrong when scrolling horizontallyv9.0.1938
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>
Diffstat (limited to 'src/drawline.c')
-rw-r--r-- | src/drawline.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/src/drawline.c b/src/drawline.c index 95ea3f025a..4d63fae34d 100644 --- a/src/drawline.c +++ b/src/drawline.c @@ -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 |