aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ops.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/ops.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/ops.c')
-rw-r--r--src/nvim/ops.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 665a102253..4d974f5760 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -1629,13 +1629,18 @@ int op_replace(oparg_T *oap, int c)
colnr_T oldlen;
struct block_def bd;
char_u *after_p = NULL;
- int had_ctrl_v_cr = (c == -1 || c == -2);
+ int had_ctrl_v_cr = false;
if ((curbuf->b_ml.ml_flags & ML_EMPTY ) || oap->empty)
return OK; /* nothing to do */
- if (had_ctrl_v_cr)
- c = (c == -1 ? '\r' : '\n');
+ if (c == REPLACE_CR_NCHAR) {
+ had_ctrl_v_cr = true;
+ c = CAR;
+ } else if (c == REPLACE_NL_NCHAR) {
+ had_ctrl_v_cr = true;
+ c = NL;
+ }
if (has_mbyte)
mb_adjust_opend(oap);
@@ -1713,7 +1718,7 @@ int op_replace(oparg_T *oap, int c)
// insert pre-spaces
memset(newp + bd.textcol, ' ', (size_t)bd.startspaces);
// insert replacement chars CHECK FOR ALLOCATED SPACE
- // -1/-2 is used for entering CR literally.
+ // REPLACE_CR_NCHAR/REPLACE_NL_NCHAR is used for entering CR literally.
size_t after_p_len = 0;
if (had_ctrl_v_cr || (c != '\r' && c != '\n')) {
// strlen(newp) at this point