aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/normal.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-02-11 19:59:37 +0100
committerGitHub <noreply@github.com>2018-02-11 19:59:37 +0100
commitf389196a344591da2f6cc2a63f4953e34316f954 (patch)
tree8cce092c29f33ae109dcf61e12e822d84aa014c7 /src/nvim/normal.c
parent2cfc1b055bba6bb0f7e263a69079c7f52303a78a (diff)
parentf26a4d484b486019c90fc55af5e74e33de374bc4 (diff)
downloadrneovim-f389196a344591da2f6cc2a63f4953e34316f954.tar.gz
rneovim-f389196a344591da2f6cc2a63f4953e34316f954.tar.bz2
rneovim-f389196a344591da2f6cc2a63f4953e34316f954.zip
Merge #7960 'vim patches'
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r--src/nvim/normal.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index bca4a0f93e..8f585aef73 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -1637,16 +1637,22 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
/* Prepare for redoing. Only use the nchar field for "r",
* otherwise it might be the second char of the operator. */
if (cap->cmdchar == 'g' && (cap->nchar == 'n'
- || cap->nchar == 'N'))
+ || cap->nchar == 'N')) {
prep_redo(oap->regname, cap->count0,
- get_op_char(oap->op_type), get_extra_op_char(oap->op_type),
- oap->motion_force, cap->cmdchar, cap->nchar);
- else if (cap->cmdchar != ':')
- prep_redo(oap->regname, 0L, NUL, 'v',
- get_op_char(oap->op_type),
- get_extra_op_char(oap->op_type),
- oap->op_type == OP_REPLACE
- ? cap->nchar : NUL);
+ get_op_char(oap->op_type), get_extra_op_char(oap->op_type),
+ oap->motion_force, cap->cmdchar, cap->nchar);
+ } else if (cap->cmdchar != ':') {
+ int nchar = oap->op_type == OP_REPLACE ? cap->nchar : NUL;
+
+ // reverse what nv_replace() did
+ if (nchar == REPLACE_CR_NCHAR) {
+ nchar = CAR;
+ } else if (nchar == REPLACE_NL_NCHAR) {
+ nchar = NL;
+ }
+ prep_redo(oap->regname, 0L, NUL, 'v', get_op_char(oap->op_type),
+ get_extra_op_char(oap->op_type), nchar);
+ }
if (!redo_VIsual_busy) {
redo_VIsual_mode = resel_VIsual_mode;
redo_VIsual_vcol = resel_VIsual_vcol;
@@ -5854,10 +5860,13 @@ static void nv_replace(cmdarg_T *cap)
if (got_int)
reset_VIsual();
if (had_ctrl_v) {
- if (cap->nchar == '\r')
- cap->nchar = -1;
- else if (cap->nchar == '\n')
- cap->nchar = -2;
+ // Use a special (negative) number to make a difference between a
+ // literal CR or NL and a line break.
+ if (cap->nchar == CAR) {
+ cap->nchar = REPLACE_CR_NCHAR;
+ } else if (cap->nchar == NL) {
+ cap->nchar = REPLACE_NL_NCHAR;
+ }
}
nv_operator(cap);
return;