|
|
44ca1a |
diff -up vim82/src/normal.c.cve-3796 vim82/src/normal.c
|
|
|
44ca1a |
--- vim82/src/normal.c.cve-3796 2021-03-22 10:02:42.000000000 +0100
|
|
|
44ca1a |
+++ vim82/src/normal.c 2021-10-15 10:45:21.397258123 +0200
|
|
|
44ca1a |
@@ -5076,19 +5076,23 @@ nv_replace(cmdarg_T *cap)
|
|
|
44ca1a |
{
|
|
|
44ca1a |
/*
|
|
|
44ca1a |
* Get ptr again, because u_save and/or showmatch() will have
|
|
|
44ca1a |
- * released the line. At the same time we let know that the
|
|
|
44ca1a |
- * line will be changed.
|
|
|
44ca1a |
+ * released the line. This may also happen in ins_copychar().
|
|
|
44ca1a |
+ * At the same time we let know that the line will be changed.
|
|
|
44ca1a |
*/
|
|
|
44ca1a |
- ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, TRUE);
|
|
|
44ca1a |
if (cap->nchar == Ctrl_E || cap->nchar == Ctrl_Y)
|
|
|
44ca1a |
{
|
|
|
44ca1a |
int c = ins_copychar(curwin->w_cursor.lnum
|
|
|
44ca1a |
+ (cap->nchar == Ctrl_Y ? -1 : 1));
|
|
|
44ca1a |
+
|
|
|
44ca1a |
+ ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, TRUE);
|
|
|
44ca1a |
if (c != NUL)
|
|
|
44ca1a |
ptr[curwin->w_cursor.col] = c;
|
|
|
44ca1a |
}
|
|
|
44ca1a |
else
|
|
|
44ca1a |
+ {
|
|
|
44ca1a |
+ ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, TRUE);
|
|
|
44ca1a |
ptr[curwin->w_cursor.col] = cap->nchar;
|
|
|
44ca1a |
+ }
|
|
|
44ca1a |
if (p_sm && msg_silent == 0)
|
|
|
44ca1a |
showmatch(cap->nchar);
|
|
|
44ca1a |
++curwin->w_cursor.col;
|
|
|
44ca1a |
diff -up vim82/src/testdir/test_edit.vim.cve-3796 vim82/src/testdir/test_edit.vim
|
|
|
44ca1a |
--- vim82/src/testdir/test_edit.vim.cve-3796 2021-10-15 10:45:21.398258115 +0200
|
|
|
44ca1a |
+++ vim82/src/testdir/test_edit.vim 2021-10-15 10:46:22.892764135 +0200
|
|
|
44ca1a |
@@ -1844,4 +1844,16 @@ func Test_read_invalid()
|
|
|
44ca1a |
set encoding=utf-8
|
|
|
44ca1a |
endfunc
|
|
|
44ca1a |
|
|
|
44ca1a |
+" Test for getting the character of the line below after "p"
|
|
|
44ca1a |
+func Test_edit_put_CTRL_E()
|
|
|
44ca1a |
+ set encoding=latin1
|
|
|
44ca1a |
+ new
|
|
|
44ca1a |
+ let @" = ''
|
|
|
44ca1a |
+ sil! norm or?ggRx
|
|
|
44ca1a |
+ sil! norm pr?
|
|
|
44ca1a |
+ call assert_equal(['r', 'r'], getline(1, 2))
|
|
|
44ca1a |
+ bwipe!
|
|
|
44ca1a |
+ set encoding=utf-8
|
|
|
44ca1a |
+endfunc
|
|
|
44ca1a |
+
|
|
|
44ca1a |
" vim: shiftwidth=2 sts=2 expandtab
|