diff options
Diffstat (limited to 'src/normal.c')
| -rw-r--r-- | src/normal.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/normal.c b/src/normal.c index a7301162b..98f4a0a9f 100644 --- a/src/normal.c +++ b/src/normal.c @@ -7070,7 +7070,18 @@ nv_replace(cap) for (n = cap->count1; n > 0; --n) { State = REPLACE; - ins_char(cap->nchar); + if (cap->nchar == Ctrl_E || cap->nchar == Ctrl_Y) + { + int c = ins_copychar(curwin->w_cursor.lnum + + (cap->nchar == Ctrl_Y ? -1 : 1)); + if (c != NUL) + ins_char(c); + else + /* will be decremented further down */ + ++curwin->w_cursor.col; + } + else + ins_char(cap->nchar); State = old_State; if (cap->ncharC1 != 0) ins_char(cap->ncharC1); @@ -7092,7 +7103,15 @@ nv_replace(cap) * line will be changed. */ ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, TRUE); - ptr[curwin->w_cursor.col] = cap->nchar; + if (cap->nchar == Ctrl_E || cap->nchar == Ctrl_Y) + { + int c = ins_copychar(curwin->w_cursor.lnum + + (cap->nchar == Ctrl_Y ? -1 : 1)); + if (c != NUL) + ptr[curwin->w_cursor.col] = c; + } + else + ptr[curwin->w_cursor.col] = cap->nchar; if (p_sm && msg_silent == 0) showmatch(cap->nchar); ++curwin->w_cursor.col; |
