aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/regexp.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-06-13 07:18:38 +0800
committerGitHub <noreply@github.com>2022-06-13 07:18:38 +0800
commitc665773897ca31c6e1270c2d52939e33df35106b (patch)
treef6d5e1c61e76f561806135e79ecd111a7d2d4e64 /src/nvim/regexp.c
parent3c7b91da10436fb503934a735958b445bbde580e (diff)
parent8bc48273eb9629409c26b811d6c8a7025f53a3cf (diff)
downloadrneovim-c665773897ca31c6e1270c2d52939e33df35106b.tar.gz
rneovim-c665773897ca31c6e1270c2d52939e33df35106b.tar.bz2
rneovim-c665773897ca31c6e1270c2d52939e33df35106b.zip
Merge pull request #18931 from zeertzjq/regexp-num-escaped
fix(substitute): subtract number of backslashes later
Diffstat (limited to 'src/nvim/regexp.c')
-rw-r--r--src/nvim/regexp.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c
index 44c9928f7b..352f4dfe39 100644
--- a/src/nvim/regexp.c
+++ b/src/nvim/regexp.c
@@ -1737,10 +1737,6 @@ static int vim_regsub_both(char_u *source, typval_T *expr, char_u *dest, int des
static char_u *eval_result = NULL;
bool copy = flags & REGSUB_COPY;
- // We need to keep track of how many backslashes we escape, so that the byte
- // counts for `extmark_splice` are correct.
- int num_escaped = 0;
-
// Be paranoid...
if ((source == NULL && expr == NULL) || dest == NULL) {
emsg(_(e_null));
@@ -1928,7 +1924,6 @@ static int vim_regsub_both(char_u *source, typval_T *expr, char_u *dest, int des
// later. Used to insert a literal CR.
default:
if (flags & REGSUB_BACKSLASH) {
- num_escaped += 1;
if (copy) {
if (dst + 1 > dest + destlen) {
iemsg("vim_regsub_both(): not enough space");
@@ -2096,7 +2091,7 @@ static int vim_regsub_both(char_u *source, typval_T *expr, char_u *dest, int des
}
exit:
- return (int)((dst - dest) + 1 - num_escaped);
+ return (int)((dst - dest) + 1);
}
/*