Mercurial > vim
changeset 3501:75037f9bc97a v7.3.513
updated for version 7.3.513
Problem: Cannot use CTRL-E and CTRL-Y with "r".
Solution: Make CTRL-E and CTRL-Y work like in Insert mode. (Christian
Brabandt)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Mon, 30 Apr 2012 18:18:47 +0200 |
parents | 873df55f5314 |
children | 65492b0466a7 |
files | src/edit.c src/normal.c src/proto/edit.pro src/version.c |
diffstat | 4 files changed, 25 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/edit.c +++ b/src/edit.c @@ -253,7 +253,6 @@ static int ins_eol __ARGS((int c)); #ifdef FEAT_DIGRAPHS static int ins_digraph __ARGS((void)); #endif -static int ins_copychar __ARGS((linenr_T lnum)); static int ins_ctrl_ey __ARGS((int tc)); #ifdef FEAT_SMARTINDENT static void ins_try_si __ARGS((int c)); @@ -9899,7 +9898,7 @@ ins_digraph() * Handle CTRL-E and CTRL-Y in Insert mode: copy char from other line. * Returns the char to be inserted, or NUL if none found. */ - static int + int ins_copychar(lnum) linenr_T lnum; {
--- 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;