changeset 89027:8772b1a86905

(Freplace_match): Fix for the unibyte case.
author Kenichi Handa <handa@m17n.org>
date Tue, 20 Aug 2002 08:32:34 +0000
parents 7f85fb19352a
children 4215ff2d202d
files src/search.c
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/search.c	Tue Aug 20 08:20:31 2002 +0000
+++ b/src/search.c	Tue Aug 20 08:32:34 2002 +0000
@@ -2245,14 +2245,20 @@
     {
       /* Decide how to casify by examining the matched text. */
       int last;
+      int multibyte;
 
       pos = search_regs.start[sub];
       last = search_regs.end[sub];
 
       if (NILP (string))
-	pos_byte = CHAR_TO_BYTE (pos);
+	{
+	  pos_byte = CHAR_TO_BYTE (pos);
+	  multibyte = ! NILP (current_buffer->enable_multibyte_characters);
       else
-	pos_byte = string_char_to_byte (string, pos);
+	{
+	  pos_byte = string_char_to_byte (string, pos);
+	  multibyte = STRING_MULTIBYTE (string);
+	}
 
       prevc = '\n';
       case_action = all_caps;
@@ -2273,6 +2279,10 @@
 	    }
 	  else
 	    FETCH_STRING_CHAR_ADVANCE (c, string, pos, pos_byte);
+	  if (! multibyte)
+	    {
+	      MAKE_CHAR_MULTIBYTE (c);
+	    }
 
 	  if (LOWERCASEP (c))
 	    {