]> git.eshelyaron.com Git - emacs.git/commitdiff
(GET_CHAR_BEFORE_2): Fix for the case that the previous
authorKenichi Handa <handa@m17n.org>
Thu, 16 Jan 2003 01:44:35 +0000 (01:44 +0000)
committerKenichi Handa <handa@m17n.org>
Thu, 16 Jan 2003 01:44:35 +0000 (01:44 +0000)
char is eight-bit-graphic.
(re_search_2): Likewise.

src/ChangeLog
src/regex.c

index 3b382bf06d4431709a248db95a1f3e71df198ce4..57a00d8e514685681bed7442ed007d6a55cd0bcc 100644 (file)
@@ -1,3 +1,9 @@
+2003-01-16  Kenichi Handa  <handa@m17n.org>
+
+       * regex.c (GET_CHAR_BEFORE_2): Fix for the case that the previous
+       char is eight-bit-graphic.
+       (re_search_2): Likewise.
+
 2003-01-15  Kenichi Handa  <handa@m17n.org>
 
        * xdisp.c (message_dolog): Fix bug of the case that *Message*
index 15ce02a142529b7260e7f482cc342e21b79d06e7..f9ea4a558dfcf43688dff1c9fd7a21e7c6d9161c 100644 (file)
        {                                                               \
         re_char *dtemp = (p) == (str2) ? (end1) : (p);                 \
         re_char *dlimit = ((p) > (str2) && (p) <= (end2)) ? (str2) : (str1); \
+        re_char *d0 = dtemp;                                           \
         while (dtemp-- > dlimit && !CHAR_HEAD_P (*dtemp));             \
-        c = STRING_CHAR (dtemp, (p) - dtemp);                          \
+        if (MULTIBYTE_FORM_LENGTH (dtemp, d0 - dtemp) == d0 - dtemp)   \
+          c = STRING_CHAR (dtemp, d0 - dtemp);                         \
+        else                                                           \
+          c = d0[-1];                                                  \
        }                                                               \
      else                                                              \
        (c = ((p) == (str2) ? (end1) : (p))[-1]);                       \
@@ -4046,18 +4050,16 @@ re_search_2 (bufp, str1, size1, str2, size2, startpos, range, regs, stop)
                p--, len++;
 
              /* Adjust it. */
-#if 0                          /* XXX */
              if (MULTIBYTE_FORM_LENGTH (p, len + 1) != (len + 1))
-               ;
-             else
-#endif
-               {
-                 range += len;
-                 if (range > 0)
-                   break;
+               /* The previous character is eight-bit-graphic which
+                  is represented by one byte even in a multibyte
+                  buffer/string.  */
+               len = 0;
+             range += len;
+             if (range > 0)
+               break;
 
-                 startpos -= len;
-               }
+             startpos -= len;
            }
        }
     }