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>
diff --git a/src/message.c b/src/message.c
index 98a3624..2fc6cef 100644
--- a/src/message.c
+++ b/src/message.c
@@ -2005,10 +2005,13 @@
{
attr = 0;
c = *s++;
- in_multispace = c == ' '
- && ((col > 0 && s[-2] == ' ') || *s == ' ');
- if (!in_multispace)
- multispace_pos = 0;
+ if (list)
+ {
+ in_multispace = c == ' ' && (*s == ' '
+ || (col > 0 && s[-2] == ' '));
+ if (!in_multispace)
+ multispace_pos = 0;
+ }
if (c == TAB && (!list || curwin->w_lcs_chars.tab1))
{
// tab amount depends on current column
@@ -2062,7 +2065,7 @@
}
else if (c == ' ')
{
- if (list && lead != NULL && s <= lead && in_multispace
+ if (lead != NULL && s <= lead && in_multispace
&& curwin->w_lcs_chars.leadmultispace != NULL)
{
c = curwin->w_lcs_chars.leadmultispace[multispace_pos++];
@@ -2082,7 +2085,7 @@
c = curwin->w_lcs_chars.trail;
attr = HL_ATTR(HLF_8);
}
- else if (list && in_multispace
+ else if (in_multispace
&& curwin->w_lcs_chars.multispace != NULL)
{
c = curwin->w_lcs_chars.multispace[multispace_pos++];