Patch 9.0.0439 (after 9.0.0438)
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)
Files: src/charset.c, src/testdir/test_textprop.vim,
src/testdir/dumps/Test_prop_with_text_above_2.dump,
src/testdir/dumps/Test_prop_with_text_above_3.dump
*** ../vim-9.0.0438/src/charset.c 2022-09-10 20:00:31.117468669 +0100
--- src/charset.c 2022-09-10 22:22:04.016022985 +0100
***************
*** 1576,1581 ****
--- 1576,1584 ----
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
}
*** ../vim-9.0.0438/src/testdir/test_textprop.vim 2022-09-10
20:00:31.121468657 +0100
--- src/testdir/test_textprop.vim 2022-09-10 22:30:24.334609081 +0100
***************
*** 2865,2870 ****
--- 2865,2875 ----
let buf = RunVimInTerminal('-S XscriptPropsWithTextAbove', #{rows: 9, cols:
60})
call VerifyScreenDump(buf, 'Test_prop_with_text_above_1', {})
+ call term_sendkeys(buf, "ggI")
+ call VerifyScreenDump(buf, 'Test_prop_with_text_above_2', {})
+ call term_sendkeys(buf, "inserted \<Esc>")
+ call VerifyScreenDump(buf, 'Test_prop_with_text_above_3', {})
+
call StopVimInTerminal(buf)
endfunc
*** ../vim-9.0.0438/src/testdir/dumps/Test_prop_with_text_above_2.dump
2022-09-10 22:31:36.126421165 +0100
--- src/testdir/dumps/Test_prop_with_text_above_2.dump 2022-09-10
22:30:29.898594422 +0100
***************
*** 0 ****
--- 1,9 ----
+ |f+0&#ffff4012|i|r|s|t| |t|h|i|n|g| |a|b|o|v|e| @42
+ |s+0&#ffd7ff255|e|c|o|n|d| |t|h|i|n|g| |a|b|o|v|e| @41
+ >o+0&#ffffff0|n|e| |t|w|o| @52
+ |t|h|r|e@1| |f|o|u|r| @49
+ |a+0&#ffff4012|n|o|t|h|e|r| |t|h|i|n|g| @46
+ |f+0&#ffffff0|i|v|e| |s|i|x| @51
+ |~+0#4040ff13&| @58
+ |~| @58
+ |-+2#0000000&@1| |I|N|S|E|R|T| |-@1| +0&&@29|1|,|1|-|1|2|1| @6|A|l@1|
*** ../vim-9.0.0438/src/testdir/dumps/Test_prop_with_text_above_3.dump
2022-09-10 22:31:36.130421155 +0100
--- src/testdir/dumps/Test_prop_with_text_above_3.dump 2022-09-10
22:30:31.050591388 +0100
***************
*** 0 ****
--- 1,9 ----
+ |f+0&#ffff4012|i|r|s|t| |t|h|i|n|g| |a|b|o|v|e| @42
+ |s+0&#ffd7ff255|e|c|o|n|d| |t|h|i|n|g| |a|b|o|v|e| @41
+ |i+0&#ffffff0|n|s|e|r|t|e|d> |o|n|e| |t|w|o| @43
+ |t|h|r|e@1| |f|o|u|r| @49
+ |a+0&#ffff4012|n|o|t|h|e|r| |t|h|i|n|g| @46
+ |f+0&#ffffff0|i|v|e| |s|i|x| @51
+ |~+0#4040ff13&| @58
+ |~| @58
+ | +0#0000000&@41|1|,|9|-|1|2|9| @6|A|l@1|
*** ../vim-9.0.0438/src/version.c 2022-09-10 20:00:31.121468657 +0100
--- src/version.c 2022-09-10 22:24:33.679575267 +0100
***************
*** 705,706 ****
--- 705,708 ----
{ /* Add new patch number below this line */
+ /**/
+ 439,
/**/
--
Portable Computer: A device invented to force businessmen
to work at home, on vacation, and on business trips.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20220910213240.60D001C0CF3%40moolenaar.net.