Patch 9.0.0252
Problem: Cursor in wrong place after virtual text.
Solution: Do not change the length of a virtual text property.
(closes #10964)
Files: src/textprop.c, src/testdir/test_textprop.vim,
src/testdir/dumps/Test_prop_text_change_arg_1.dump,
src/testdir/dumps/Test_prop_text_change_arg_2.dump
*** ../vim-9.0.0251/src/textprop.c 2022-08-23 18:39:14.756797669 +0100
--- src/textprop.c 2022-08-24 12:07:41.132976220 +0100
***************
*** 2127,2133 ****
else
prop->tp_col += added;
}
! else if (prop->tp_len > 0 && prop->tp_col + prop->tp_len > col)
{
int after = col - added - (prop->tp_col - 1 + prop->tp_len);
--- 2127,2134 ----
else
prop->tp_col += added;
}
! else if (prop->tp_len > 0 && prop->tp_col + prop->tp_len > col
! && prop->tp_id >= 0) // don't change length for virtual text
{
int after = col - added - (prop->tp_col - 1 + prop->tp_len);
*** ../vim-9.0.0251/src/testdir/test_textprop.vim 2022-08-23
18:39:14.760797662 +0100
--- src/testdir/test_textprop.vim 2022-08-24 12:21:36.483628253 +0100
***************
*** 3091,3094 ****
--- 3091,3130 ----
call delete('XscriptPropsPadded')
endfunc
+ func Test_insert_text_change_arg()
+ CheckRunVimInTerminal
+
+ let lines =<< trim END
+ vim9script
+ setline(1, ['SetErrorCode( 10, 20 )', 'second line'])
+ prop_type_add('param', {highlight: 'DiffChange', start_incl: 1})
+ prop_type_add('padd', {highlight: 'NonText', start_incl: 1})
+ prop_add(1, 15, {
+ type: 'param',
+ text: 'id:',
+ })
+ prop_add(1, 15, {
+ type: 'padd',
+ text: '-',
+ })
+ prop_add(1, 19, {
+ type: 'param',
+ text: 'id:',
+ })
+ prop_add(1, 19, {
+ type: 'padd',
+ text: '-',
+ })
+ END
+ call writefile(lines, 'XscriptPropsChange')
+ let buf = RunVimInTerminal('-S XscriptPropsChange', #{rows: 5, cols: 60})
+ call VerifyScreenDump(buf, 'Test_prop_text_change_arg_1', {})
+
+ call term_sendkeys(buf, "ggf1cw1234\<Esc>")
+ call VerifyScreenDump(buf, 'Test_prop_text_change_arg_2', {})
+
+ call StopVimInTerminal(buf)
+ call delete('XscriptPropsChange')
+ endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-9.0.0251/src/testdir/dumps/Test_prop_text_change_arg_1.dump
2022-08-24 12:23:44.643419716 +0100
--- src/testdir/dumps/Test_prop_text_change_arg_1.dump 2022-08-24
12:21:39.851622764 +0100
***************
*** 0 ****
--- 1,5 ----
+ >S+0&#ffffff0|e|t|E|r@1|o|r|C|o|d|e|(|
|i+0&#ffd7ff255|d|:|-+0#4040ff13#ffffff0|1+0#0000000&|0|,|
|i+0&#ffd7ff255|d|:|-+0#4040ff13#ffffff0|2+0#0000000&|0| |)| @29
+ |s|e|c|o|n|d| |l|i|n|e| @48
+ |~+0#4040ff13&| @58
+ |~| @58
+ | +0#0000000&@41|1|,|1| @10|A|l@1|
*** ../vim-9.0.0251/src/testdir/dumps/Test_prop_text_change_arg_2.dump
2022-08-24 12:23:44.647419709 +0100
--- src/testdir/dumps/Test_prop_text_change_arg_2.dump 2022-08-24
12:21:40.999620895 +0100
***************
*** 0 ****
--- 1,5 ----
+ |S+0&#ffffff0|e|t|E|r@1|o|r|C|o|d|e|(|
|i+0&#ffd7ff255|d|:|-+0#4040ff13#ffffff0|1+0#0000000&|2|3>4|,|
|i+0&#ffd7ff255|d|:|-+0#4040ff13#ffffff0|2+0#0000000&|0| |)| @27
+ |s|e|c|o|n|d| |l|i|n|e| @48
+ |~+0#4040ff13&| @58
+ |~| @58
+ | +0#0000000&@41|1|,|1|8|-|2@1| @6|A|l@1|
*** ../vim-9.0.0251/src/version.c 2022-08-24 11:26:12.868214983 +0100
--- src/version.c 2022-08-24 12:09:19.648819133 +0100
***************
*** 733,734 ****
--- 733,736 ----
{ /* Add new patch number below this line */
+ /**/
+ 252,
/**/
--
LAUNCELOT: Isn't there a St. Aaaaarrrrrrggghhh's in Cornwall?
ARTHUR: No, that's Saint Ives.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// 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/20220824112527.B60A41C0D30%40moolenaar.net.