patch 9.0.0205: cursor in wrong position when inserting after virtual text
Problem: Cursor in wrong position when inserting after virtual text. (Ben
Jackson)
Solution: Put the cursor after the virtual text, where the text will be
inserted. (closes #10914)
diff --git a/src/charset.c b/src/charset.c
index a795984..1604952 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1212,6 +1212,7 @@
#endif
}
cts->cts_cur_text_width += cells;
+ cts->cts_start_incl = tp->tp_flags & TP_FLAG_START_INCL;
size += cells;
if (*s == TAB)
{
@@ -1585,7 +1586,9 @@
else
{
#ifdef FEAT_PROP_POPUP
- if ((State & MODE_INSERT) == 0 && !on_NUL)
+ // in Insert mode, if "start_incl" is true the text gets inserted
+ // after the virtual text, thus add its width
+ if (((State & MODE_INSERT) == 0 || cts.cts_start_incl) && !on_NUL)
// cursor is after inserted text, unless on the NUL
vcol += cts.cts_cur_text_width;
#endif