Patch 9.0.0163
Problem: Text property not adjusted for text inserted with "p".
Solution: Adjust column and length of text properties.
Files: src/register.c, src/testdir/test_textprop.vim
*** ../vim-9.0.0162/src/register.c 2022-07-31 11:37:16.451058499 +0100
--- src/register.c 2022-08-07 14:50:15.638677393 +0100
***************
*** 2101,2106 ****
--- 2101,2108 ----
STRMOVE(ptr, oldp + col);
ml_replace(lnum, newp, FALSE);
+ inserted_bytes(lnum, col, totlen);
+
// compute the byte offset for the last character
first_byte_off = mb_head_off(newp, ptr - 1);
***************
*** 2128,2134 ****
++curwin->w_cursor.col;
else
curwin->w_cursor.col -= first_byte_off;
- changed_bytes(lnum, col);
}
else
{
--- 2130,2135 ----
*** ../vim-9.0.0162/src/testdir/test_textprop.vim 2022-08-07 11:53:36.791410634 +0100
--- src/testdir/test_textprop.vim 2022-08-07 14:53:53.587167136 +0100
***************
*** 658,663 ****
--- 658,693 ----
set bs&
endfunc
+ func Test_prop_put()
+ new
+ let expected = SetupOneLine() " 'xonex xtwoxx'
+
+ let @a = 'new'
+ " insert just after the prop
+ normal 03l"ap
+ " insert inside the prop
+ normal 02l"ap
+ " insert just before the prop
+ normal 0"ap
+
+ call assert_equal('xnewonnewenewx xtwoxx', getline(1))
+ let expected[0].col += 3
+ let expected[0].length += 3
+ let expected[1].col += 9
+ call assert_equal(expected, prop_list(1))
+
+ " Visually select 4 chars in the prop and put "AB" to replace them
+ let @a = 'AB'
+ normal 05lv3l"ap
+ call assert_equal('xnewoABenewx xtwoxx', getline(1))
+ let expected[0].length -= 2
+ let expected[1].col -= 2
+ call assert_equal(expected, prop_list(1))
+
+ call DeletePropTypes()
+ bwipe!
+ endfunc
+
func Test_prop_clear()
new
call AddPropTypes()
*** ../vim-9.0.0162/src/version.c 2022-08-07 11:53:36.791410634 +0100
--- src/version.c 2022-08-07 14:19:23.857533692 +0100
***************
*** 737,738 ****
--- 737,740 ----
{ /* Add new patch number below this line */
+ /**/
+ 163,
/**/
--
hundred-and-one symptoms of being an internet addict:
268. You get up in the morning and go online before getting your coffee.
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///