changeset 12148:a1c38b9b0f73

(Freplace_match): Do the right thing with backslash.
author Karl Heuer <kwzh@gnu.org>
date Fri, 09 Jun 1995 01:10:11 +0000
parents 9200a0e153d3
children f1585a0ecd0c
files src/search.c
diffstat 1 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/search.c	Fri Jun 09 01:07:18 1995 +0000
+++ b/src/search.c	Fri Jun 09 01:10:11 1995 +0000
@@ -1651,6 +1651,7 @@
 	    {
 	      int substart = -1;
 	      int subend;
+	      int delbackslash = 0;
 
 	      c = XSTRING (newtext)->data[pos];
 	      if (c == '\\')
@@ -1669,11 +1670,15 @@
 			  subend = search_regs.end[c - '0'];
 			}
 		    }
+		  else if (c == '\\')
+		    delbackslash = 1;
 		}
 	      if (substart >= 0)
 		{
 		  if (pos - 1 != lastpos + 1)
-		    middle = Fsubstring (newtext, lastpos + 1, pos - 1);
+		    middle = Fsubstring (newtext,
+					 make_number (lastpos + 1),
+					 make_number (pos - 1));
 		  else
 		    middle = Qnil;
 		  accum = concat3 (accum, middle,
@@ -1681,10 +1686,18 @@
 					       make_number (subend)));
 		  lastpos = pos;
 		}
+	      else if (delbackslash)
+		{
+		  middle = Fsubstring (newtext, make_number (lastpos + 1),
+				       make_number (pos));
+		  accum = concat2 (accum, middle);
+		  lastpos = pos;
+		}
 	    }
 
 	  if (pos != lastpos + 1)
-	    middle = Fsubstring (newtext, lastpos + 1, pos);
+	    middle = Fsubstring (newtext, make_number (lastpos + 1),
+				 make_number (pos));
 	  else
 	    middle = Qnil;