patch 9.0.1770: lines disappear when modifying chars before virt text

Problem:  lines disappear when modifying chars before virt text
Solution: take virtual text property length into account

closes: #12558
closes: #12244

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Ibby <33922797+SleepySwords@users.noreply.github.com>
diff --git a/src/charset.c b/src/charset.c
index 7ffd8d8..14373c1 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -808,16 +808,14 @@
 						      MB_PTR_ADV(cts->cts_ptr))
 	cts->cts_vcol += win_lbr_chartabsize(cts, NULL);
 #ifdef FEAT_PROP_POPUP
-    // check for a virtual text on an empty line
-    if (cts->cts_has_prop_with_text && *cts->cts_ptr == NUL
-					      && cts->cts_ptr == cts->cts_line)
+    // check for a virtual text at the end of a line or on an empty line
+    if (cts->cts_has_prop_with_text && *cts->cts_ptr == NUL)
     {
 	(void)win_lbr_chartabsize(cts, NULL);
 	cts->cts_vcol += cts->cts_cur_text_width;
-
 	// when properties are above or below the empty line must also be
 	// counted
-	if (cts->cts_prop_lines > 0)
+	if (cts->cts_ptr == cts->cts_line && cts->cts_prop_lines > 0)
 	    ++cts->cts_vcol;
     }
 #endif
@@ -1190,7 +1188,7 @@
 		       || (tp->tp_col == MAXCOL
 			   && ((tp->tp_flags & TP_FLAG_ALIGN_ABOVE)
 				? col == 0
-				: (s[0] == NUL || s[charlen] == NUL)
+				: s[0] == NUL
 						  && cts->cts_with_trailing)))
 		    && -tp->tp_id - 1 < gap->ga_len)
 	    {