patch 9.0.1836: display wrong with virttext, linebreak and breakindent

Problem:  Wrong display with "above" virtual text and 'linebreak' or
          'breakindent' and 'showbreak'.
Solution: Exclude size of "above" virtual text when calculating them.

closes: #13000

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
diff --git a/src/charset.c b/src/charset.c
index 3495a0e..dc8fa44 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1209,17 +1209,18 @@
 			cells = text_prop_position(wp, tp, vcol,
 			     (vcol + size) % (wp->w_width - col_off) + col_off,
 					      &n_extra, &p, NULL, NULL, FALSE);
-#ifdef FEAT_LINEBREAK
+#  ifdef FEAT_LINEBREAK
 			no_sbr = TRUE;  // don't use 'showbreak' now
-#endif
+#  endif
 		    }
 		    else
 			cells = vim_strsize(p);
 		    cts->cts_cur_text_width += cells;
 		    if (tp->tp_flags & TP_FLAG_ALIGN_ABOVE)
 			cts->cts_first_char += cells;
+		    else
+			size += cells;
 		    cts->cts_start_incl = tp->tp_flags & TP_FLAG_START_INCL;
-		    size += cells;
 		    if (*s == TAB)
 		    {
 			// tab size changes because of the inserted text
@@ -1263,9 +1264,9 @@
 	int	col_off_prev = win_col_off(wp);
 	int	width2 = wp->w_width - col_off_prev + win_col_off2(wp);
 	colnr_T	wcol = vcol + col_off_prev;
-#ifdef FEAT_PROP_POPUP
+#  ifdef FEAT_PROP_POPUP
 	wcol -= wp->w_virtcol_first_char;
-#endif
+#  endif
 	colnr_T	max_head_vcol = cts->cts_max_head_vcol;
 	int	added = 0;
 
@@ -1319,7 +1320,7 @@
 		else if (max_head_vcol > vcol + head_prev + prev_rem)
 		    head += (max_head_vcol - (vcol + head_prev + prev_rem)
 					     + width2 - 1) / width2 * head_mid;
-#ifdef FEAT_PROP_POPUP
+#  ifdef FEAT_PROP_POPUP
 		else if (max_head_vcol < 0)
 		{
 		    int off = 0;
@@ -1329,7 +1330,7 @@
 		    if (off >= prev_rem)
 			head += (1 + (off - prev_rem) / width) * head_mid;
 		}
-#endif
+#  endif
 	    }
 	}
 
@@ -1385,6 +1386,9 @@
 	}
     }
 
+#  ifdef FEAT_PROP_POPUP
+    size += cts->cts_first_char;
+#  endif
     return size;
 # endif
 #endif