summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2012-04-30 18:18:47 +0200
committerBram Moolenaar <Bram@vim.org>2012-04-30 18:18:47 +0200
commit8320da42bc443fa5c76710d331f6b8c3cfc2981e (patch)
tree90c57ec9d2bf3814e6e7159fda58676956afea8c
parentb41d9689f1bec8434bb400b344b249180ac47668 (diff)
downloadvim-git-8320da42bc443fa5c76710d331f6b8c3cfc2981e.tar.gz
updated for version 7.3.513v7.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)
-rw-r--r--src/edit.c3
-rw-r--r--src/normal.c23
-rw-r--r--src/proto/edit.pro1
-rw-r--r--src/version.c2
4 files changed, 25 insertions, 4 deletions
diff --git a/src/edit.c b/src/edit.c
index c8320a6e2..17bbc6f2e 100644
--- 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;
{
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;
diff --git a/src/proto/edit.pro b/src/proto/edit.pro
index e2398c452..1eed37870 100644
--- a/src/proto/edit.pro
+++ b/src/proto/edit.pro
@@ -39,4 +39,5 @@ int in_cinkeys __ARGS((int keytyped, int when, int line_is_empty));
int hkmap __ARGS((int c));
void ins_scroll __ARGS((void));
void ins_horscroll __ARGS((void));
+int ins_copychar __ARGS((linenr_T lnum));
/* vim: set ft=c : */
diff --git a/src/version.c b/src/version.c
index ce22d9f99..de24ff4bd 100644
--- a/src/version.c
+++ b/src/version.c
@@ -715,6 +715,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 513,
+/**/
512,
/**/
511,