Patch 9.0.0483
Problem: Illegal memory access when replacing in virtualedit mode.
Solution: Check for replacing NUL after Tab.
Files: src/ops.c, src/testdir/test_virtualedit.vim
*** ../vim-9.0.0482/src/ops.c 2022-09-04 12:47:15.410692254 +0100
--- src/ops.c 2022-09-16 22:15:50.468166512 +0100
***************
*** 1173,1178 ****
--- 1173,1180 ----
while (LTOREQ_POS(curwin->w_cursor, oap->end))
{
+ int done = FALSE;
+
n = gchar_cursor();
if (n != NUL)
{
***************
*** 1186,1191 ****
--- 1188,1194 ----
if (curwin->w_cursor.lnum == oap->end.lnum)
oap->end.col += new_byte_len - old_byte_len;
replace_character(c);
+ done = TRUE;
}
else
{
***************
*** 1204,1213 ****
if (curwin->w_cursor.lnum == oap->end.lnum)
getvpos(&oap->end, end_vcol);
}
! PBYTE(curwin->w_cursor, c);
}
}
! else if (virtual_op && curwin->w_cursor.lnum == oap->end.lnum)
{
int virtcols = oap->end.coladd;
--- 1207,1221 ----
if (curwin->w_cursor.lnum == oap->end.lnum)
getvpos(&oap->end, end_vcol);
}
! // with "coladd" set may move to just after a TAB
! if (gchar_cursor() != NUL)
! {
! PBYTE(curwin->w_cursor, c);
! done = TRUE;
! }
}
}
! if (!done && virtual_op && curwin->w_cursor.lnum == oap->end.lnum)
{
int virtcols = oap->end.coladd;
*** ../vim-9.0.0482/src/testdir/test_virtualedit.vim 2022-08-09
14:19:36.879541842 +0100
--- src/testdir/test_virtualedit.vim 2022-09-16 22:15:29.356196943 +0100
***************
*** 572,575 ****
--- 572,589 ----
set virtualedit&
endfunc
+ " this was replacing the NUL at the end of the line
+ func Test_virtualedit_replace_after_tab()
+ new
+ s/\v/ 0
+ set ve=all
+ let @" = ''
+ sil! norm vPvr0
+
+ call assert_equal("\t0", getline(1))
+ set ve&
+ bwipe!
+ endfunc
+
+
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-9.0.0482/src/version.c 2022-09-16 20:50:44.972907916 +0100
--- src/version.c 2022-09-16 22:07:12.276952693 +0100
***************
*** 705,706 ****
--- 705,708 ----
{ /* Add new patch number below this line */
+ /**/
+ 483,
/**/
--
You can't have everything. Where would you put it?
-- Steven Wright
/// 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/20220916211744.A2BB01C0846%40moolenaar.net.