1
0
forked from aniani/vim

patch 9.0.0439: cursor wrong if inserting before line with virtual text above

Problem:    Cursor wrong if inserting before line with virtual text above.
Solution:   Add the width of the "above" virtual text to the cursor position.
            (issue #11084)
This commit is contained in:
Bram Moolenaar
2022-09-10 22:32:14 +01:00
parent 04e0ed1ddf
commit 88b79cb7d4
5 changed files with 28 additions and 0 deletions

View File

@@ -1576,6 +1576,9 @@ getvcol(
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;
else
// insertion also happens after the "above" virtual text
vcol += cts.cts_first_char;
#endif
*cursor = vcol + head; // cursor at start
}