Patch 8.2.4988

5 views
Skip to first unread message

Bram Moolenaar

unread,
May 21, 2022, 6:21:21 AM5/21/22
to vim...@googlegroups.com

Patch 8.2.4988
Problem: Textprop in wrong position when replacing multi-byte chars.
Solution: Adjust textprop position. (closes #10461)
Files: src/change.c, src/testdir/test_textprop.vim


*** ../vim-8.2.4987/src/change.c 2022-05-16 19:40:54.757799730 +0100
--- src/change.c 2022-05-21 11:17:47.550077484 +0100
***************
*** 1118,1124 ****
ml_replace(lnum, newp, FALSE);

// mark the buffer as changed and prepare for displaying
! inserted_bytes(lnum, col, newlen - oldlen);

// If we're in Insert or Replace mode and 'showmatch' is set, then briefly
// show the match for right parens and braces.
--- 1118,1129 ----
ml_replace(lnum, newp, FALSE);

// mark the buffer as changed and prepare for displaying
! changed_bytes(lnum, col);
! #ifdef FEAT_PROP_POPUP
! if (curbuf->b_has_textprop && newlen != oldlen)
! adjust_prop_columns(lnum, col, newlen - oldlen,
! State & REPLACE_FLAG ? APC_SUBSTITUTE : 0);
! #endif

// If we're in Insert or Replace mode and 'showmatch' is set, then briefly
// show the match for right parens and braces.
*** ../vim-8.2.4987/src/testdir/test_textprop.vim 2022-05-15 22:24:51.536182715 +0100
--- src/testdir/test_textprop.vim 2022-05-21 11:16:04.062085721 +0100
***************
*** 573,578 ****
--- 573,585 ----
call assert_equal('yyyex xyyoxx', getline(1))
call assert_equal(expected, prop_list(1))

+ " Replace three 1-byte chars with three 2-byte ones.
+ exe "normal 0l3rø"
+ call assert_equal('yøøøx xyyoxx', getline(1))
+ let expected[0].length += 3
+ let expected[1].col += 3
+ call assert_equal(expected, prop_list(1))
+
call DeletePropTypes()
bwipe!
set bs&
*** ../vim-8.2.4987/src/version.c 2022-05-20 18:25:15.809240687 +0100
--- src/version.c 2022-05-21 11:17:31.334078521 +0100
***************
*** 748,749 ****
--- 748,751 ----
{ /* Add new patch number below this line */
+ /**/
+ 4988,
/**/

--
"Marriage is when a man and woman become as one; the trouble starts
when they try to decide which one"

/// 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 ///
Reply all
Reply to author
Forward
0 new messages