From: Kenichi Handa Date: Thu, 16 Jan 2003 01:44:35 +0000 (+0000) Subject: (GET_CHAR_BEFORE_2): Fix for the case that the previous X-Git-Tag: emacs-pretest-21.2.94~11 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0a448cfa8b142f022d2852b3a19a3cd1ebb02b34;p=emacs.git (GET_CHAR_BEFORE_2): Fix for the case that the previous char is eight-bit-graphic. (re_search_2): Likewise. --- diff --git a/src/ChangeLog b/src/ChangeLog index 3b382bf06d4..57a00d8e514 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2003-01-16 Kenichi Handa + + * 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 * xdisp.c (message_dolog): Fix bug of the case that *Message* diff --git a/src/regex.c b/src/regex.c index 15ce02a1425..f9ea4a558df 100644 --- a/src/regex.c +++ b/src/regex.c @@ -156,8 +156,12 @@ { \ 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; } } }