summaryrefslogtreecommitdiffstats
path: root/src/charset.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-08-14 13:28:55 +0100
committerBram Moolenaar <Bram@vim.org>2022-08-14 13:28:55 +0100
commit28c9f895716cfa8f1220bc41b72a534c0e10cabe (patch)
tree274ccf5d35445ce4b46e733b209fb73edcf4ad0c /src/charset.c
parent63acae13f57c5ad4c8ec3146d0c458550b9e984e (diff)
patch 9.0.0205: cursor in wrong position when inserting after virtual textv9.0.0205
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)
Diffstat (limited to 'src/charset.c')
-rw-r--r--src/charset.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/charset.c b/src/charset.c
index a795984068..160495222a 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1212,6 +1212,7 @@ win_lbr_chartabsize(
#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 @@ getvcol(
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