Skip to content

Commit 95e0918

Browse files
committed
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)
1 parent f3f6aba commit 95e0918

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

src/edit.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,6 @@ static int ins_eol __ARGS((int c));
253253
#ifdef FEAT_DIGRAPHS
254254
static int ins_digraph __ARGS((void));
255255
#endif
256-
static int ins_copychar __ARGS((linenr_T lnum));
257256
static int ins_ctrl_ey __ARGS((int tc));
258257
#ifdef FEAT_SMARTINDENT
259258
static void ins_try_si __ARGS((int c));
@@ -9899,7 +9898,7 @@ ins_digraph()
98999898
* Handle CTRL-E and CTRL-Y in Insert mode: copy char from other line.
99009899
* Returns the char to be inserted, or NUL if none found.
99019900
*/
9902-
static int
9901+
int
99039902
ins_copychar(lnum)
99049903
linenr_T lnum;
99059904
{

src/normal.c

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7070,7 +7070,18 @@ nv_replace(cap)
70707070
for (n = cap->count1; n > 0; --n)
70717071
{
70727072
State = REPLACE;
7073-
ins_char(cap->nchar);
7073+
if (cap->nchar == Ctrl_E || cap->nchar == Ctrl_Y)
7074+
{
7075+
int c = ins_copychar(curwin->w_cursor.lnum
7076+
+ (cap->nchar == Ctrl_Y ? -1 : 1));
7077+
if (c != NUL)
7078+
ins_char(c);
7079+
else
7080+
/* will be decremented further down */
7081+
++curwin->w_cursor.col;
7082+
}
7083+
else
7084+
ins_char(cap->nchar);
70747085
State = old_State;
70757086
if (cap->ncharC1 != 0)
70767087
ins_char(cap->ncharC1);
@@ -7092,7 +7103,15 @@ nv_replace(cap)
70927103
* line will be changed.
70937104
*/
70947105
ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, TRUE);
7095-
ptr[curwin->w_cursor.col] = cap->nchar;
7106+
if (cap->nchar == Ctrl_E || cap->nchar == Ctrl_Y)
7107+
{
7108+
int c = ins_copychar(curwin->w_cursor.lnum
7109+
+ (cap->nchar == Ctrl_Y ? -1 : 1));
7110+
if (c != NUL)
7111+
ptr[curwin->w_cursor.col] = c;
7112+
}
7113+
else
7114+
ptr[curwin->w_cursor.col] = cap->nchar;
70967115
if (p_sm && msg_silent == 0)
70977116
showmatch(cap->nchar);
70987117
++curwin->w_cursor.col;

src/proto/edit.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,5 @@ int in_cinkeys __ARGS((int keytyped, int when, int line_is_empty));
3939
int hkmap __ARGS((int c));
4040
void ins_scroll __ARGS((void));
4141
void ins_horscroll __ARGS((void));
42+
int ins_copychar __ARGS((linenr_T lnum));
4243
/* vim: set ft=c : */

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,8 @@ static char *(features[]) =
714714

715715
static int included_patches[] =
716716
{ /* Add new patch number below this line */
717+
/**/
718+
513,
717719
/**/
718720
512,
719721
/**/

0 commit comments

Comments
 (0)