|
|
54c882 |
diff --git a/src/normal.c b/src/normal.c
|
|
|
54c882 |
index be0e75e..7d62e20 100644
|
|
|
54c882 |
--- a/src/normal.c
|
|
|
54c882 |
+++ b/src/normal.c
|
|
|
54c882 |
@@ -7147,19 +7147,23 @@ nv_replace(cmdarg_T *cap)
|
|
|
54c882 |
{
|
|
|
54c882 |
/*
|
|
|
54c882 |
* Get ptr again, because u_save and/or showmatch() will have
|
|
|
54c882 |
- * released the line. At the same time we let know that the
|
|
|
54c882 |
- * line will be changed.
|
|
|
54c882 |
+ * released the line. This may also happen in ins_copychar().
|
|
|
54c882 |
+ * At the same time we let know that the line will be changed.
|
|
|
54c882 |
*/
|
|
|
54c882 |
- ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, TRUE);
|
|
|
54c882 |
if (cap->nchar == Ctrl_E || cap->nchar == Ctrl_Y)
|
|
|
54c882 |
{
|
|
|
54c882 |
int c = ins_copychar(curwin->w_cursor.lnum
|
|
|
54c882 |
+ (cap->nchar == Ctrl_Y ? -1 : 1));
|
|
|
54c882 |
+
|
|
|
54c882 |
+ ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, TRUE);
|
|
|
54c882 |
if (c != NUL)
|
|
|
54c882 |
ptr[curwin->w_cursor.col] = c;
|
|
|
54c882 |
}
|
|
|
54c882 |
else
|
|
|
54c882 |
+ {
|
|
|
54c882 |
+ ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, TRUE);
|
|
|
54c882 |
ptr[curwin->w_cursor.col] = cap->nchar;
|
|
|
54c882 |
+ }
|
|
|
54c882 |
if (p_sm && msg_silent == 0)
|
|
|
54c882 |
showmatch(cap->nchar);
|
|
|
54c882 |
++curwin->w_cursor.col;
|
|
|
54c882 |
diff --git a/src/testdir/test_edit.vim b/src/testdir/test_edit.vim
|
|
|
54c882 |
index 7278bcd..8818805 100644
|
|
|
54c882 |
--- a/src/testdir/test_edit.vim
|
|
|
54c882 |
+++ b/src/testdir/test_edit.vim
|
|
|
54c882 |
@@ -1387,3 +1387,15 @@ func Test_edit_quit()
|
|
|
54c882 |
only
|
|
|
54c882 |
endfunc
|
|
|
54c882 |
|
|
|
54c882 |
+" Test for getting the character of the line below after "p"
|
|
|
54c882 |
+func Test_edit_put_CTRL_E()
|
|
|
54c882 |
+ set encoding=latin1
|
|
|
54c882 |
+ new
|
|
|
54c882 |
+ let @" = ''
|
|
|
54c882 |
+ sil! norm or?ggRx
|
|
|
54c882 |
+ sil! norm pr?
|
|
|
54c882 |
+ call assert_equal(['r', 'r'], getline(1, 2))
|
|
|
54c882 |
+ bwipe!
|
|
|
54c882 |
+ set encoding=utf-8
|
|
|
54c882 |
+endfunc
|
|
|
54c882 |
+
|