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/drawline.c b/src/drawline.c
index 95ea3f0..4d63fae 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -1684,6 +1684,27 @@
 	    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 @@
 #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 @@
 		    }
 		}
 #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