aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/search.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/search.c b/src/search.c
index 225155d73ac..3ee17bf3abc 100644
--- a/src/search.c
+++ b/src/search.c
@@ -2300,8 +2300,8 @@ since only regular expressions have distinguished subexpressions.")
2300 if desired. */ 2300 if desired. */
2301 if (NILP (literal)) 2301 if (NILP (literal))
2302 { 2302 {
2303 int lastpos = -1; 2303 int lastpos = 0;
2304 int lastpos_byte = -1; 2304 int lastpos_byte = 0;
2305 /* We build up the substituted string in ACCUM. */ 2305 /* We build up the substituted string in ACCUM. */
2306 Lisp_Object accum; 2306 Lisp_Object accum;
2307 Lisp_Object middle; 2307 Lisp_Object middle;
@@ -2340,10 +2340,10 @@ since only regular expressions have distinguished subexpressions.")
2340 } 2340 }
2341 if (substart >= 0) 2341 if (substart >= 0)
2342 { 2342 {
2343 if (pos - 1 != lastpos + 1) 2343 if (pos - 2 != lastpos)
2344 middle = substring_both (newtext, lastpos + 1, 2344 middle = substring_both (newtext, lastpos,
2345 lastpos_byte + 1, 2345 lastpos_byte,
2346 pos - 1, pos_byte - 1); 2346 pos - 2, pos_byte - 2);
2347 else 2347 else
2348 middle = Qnil; 2348 middle = Qnil;
2349 accum = concat3 (accum, middle, 2349 accum = concat3 (accum, middle,
@@ -2355,9 +2355,9 @@ since only regular expressions have distinguished subexpressions.")
2355 } 2355 }
2356 else if (delbackslash) 2356 else if (delbackslash)
2357 { 2357 {
2358 middle = substring_both (newtext, lastpos + 1, 2358 middle = substring_both (newtext, lastpos,
2359 lastpos_byte + 1, 2359 lastpos_byte,
2360 pos, pos_byte); 2360 pos - 1, pos_byte - 1);
2361 2361
2362 accum = concat2 (accum, middle); 2362 accum = concat2 (accum, middle);
2363 lastpos = pos; 2363 lastpos = pos;
@@ -2365,9 +2365,9 @@ since only regular expressions have distinguished subexpressions.")
2365 } 2365 }
2366 } 2366 }
2367 2367
2368 if (pos != lastpos + 1) 2368 if (pos != lastpos)
2369 middle = substring_both (newtext, lastpos + 1, 2369 middle = substring_both (newtext, lastpos,
2370 lastpos_byte + 1, 2370 lastpos_byte,
2371 pos, pos_byte); 2371 pos, pos_byte);
2372 else 2372 else
2373 middle = Qnil; 2373 middle = Qnil;