diff options
| author | Kenichi Handa | 2005-10-14 07:55:05 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2005-10-14 07:55:05 +0000 |
| commit | fed91c3814f41f8adc5a9a1c32e5c5580cea8510 (patch) | |
| tree | df88c839621e10df37d5aef216966dadaef0fb8e /src | |
| parent | cac3d6206bd12b1c9c81a0f5411bcaf66eeb49dd (diff) | |
| download | emacs-fed91c3814f41f8adc5a9a1c32e5c5580cea8510.tar.gz emacs-fed91c3814f41f8adc5a9a1c32e5c5580cea8510.zip | |
(search_buffer): Give up BM search on case-fold-search
if one of a target character has a case-equivalence of different
charset even if that target charcter is an ASCII.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 9 | ||||
| -rw-r--r-- | src/search.c | 40 |
2 files changed, 33 insertions, 16 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 30db0548172..6c63a3cd20b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2005-10-14 Kenichi Handa <handa@m17n.org> | ||
| 2 | |||
| 3 | * search.c (search_buffer): Give up BM search on case-fold-search | ||
| 4 | if one of a target character has a case-equivalence of different | ||
| 5 | charset even if that target charcter is an ASCII. | ||
| 6 | |||
| 7 | * casefiddle.c (casify_object): Fix for the case that case | ||
| 8 | conversion change the byte length. | ||
| 9 | |||
| 1 | 2005-10-14 Kim F. Storm <storm@cua.dk> | 10 | 2005-10-14 Kim F. Storm <storm@cua.dk> |
| 2 | 11 | ||
| 3 | * xterm.c (note_mouse_movement): Return 1 if mouse moved; 0 otherwise. | 12 | * xterm.c (note_mouse_movement): Return 1 if mouse moved; 0 otherwise. |
diff --git a/src/search.c b/src/search.c index aa7f6fda699..f60e6d0cfe2 100644 --- a/src/search.c +++ b/src/search.c | |||
| @@ -1175,9 +1175,9 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n, | |||
| 1175 | unsigned char *patbuf; | 1175 | unsigned char *patbuf; |
| 1176 | int multibyte = !NILP (current_buffer->enable_multibyte_characters); | 1176 | int multibyte = !NILP (current_buffer->enable_multibyte_characters); |
| 1177 | unsigned char *base_pat = SDATA (string); | 1177 | unsigned char *base_pat = SDATA (string); |
| 1178 | /* Set to nozero if we find a non-ASCII char that need | 1178 | /* Set to positive if we find a non-ASCII char that need |
| 1179 | translation. */ | 1179 | translation. Otherwise set to zero later. */ |
| 1180 | int charset_base = 0; | 1180 | int charset_base = -1; |
| 1181 | int boyer_moore_ok = 1; | 1181 | int boyer_moore_ok = 1; |
| 1182 | 1182 | ||
| 1183 | /* MULTIBYTE says whether the text to be searched is multibyte. | 1183 | /* MULTIBYTE says whether the text to be searched is multibyte. |
| @@ -1275,24 +1275,30 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n, | |||
| 1275 | always handle their translation. */ | 1275 | always handle their translation. */ |
| 1276 | while (1) | 1276 | while (1) |
| 1277 | { | 1277 | { |
| 1278 | if (! ASCII_BYTE_P (inverse)) | 1278 | if (ASCII_BYTE_P (inverse)) |
| 1279 | { | 1279 | { |
| 1280 | if (SINGLE_BYTE_CHAR_P (inverse)) | 1280 | if (charset_base > 0) |
| 1281 | { | ||
| 1282 | /* Boyer-moore search can't handle a | ||
| 1283 | translation of an eight-bit | ||
| 1284 | character. */ | ||
| 1285 | boyer_moore_ok = 0; | ||
| 1286 | break; | ||
| 1287 | } | ||
| 1288 | else if (charset_base == 0) | ||
| 1289 | charset_base = inverse & ~CHAR_FIELD3_MASK; | ||
| 1290 | else if ((inverse & ~CHAR_FIELD3_MASK) | ||
| 1291 | != charset_base) | ||
| 1292 | { | 1281 | { |
| 1293 | boyer_moore_ok = 0; | 1282 | boyer_moore_ok = 0; |
| 1294 | break; | 1283 | break; |
| 1295 | } | 1284 | } |
| 1285 | charset_base = 0; | ||
| 1286 | } | ||
| 1287 | else if (SINGLE_BYTE_CHAR_P (inverse)) | ||
| 1288 | { | ||
| 1289 | /* Boyer-moore search can't handle a | ||
| 1290 | translation of an eight-bit | ||
| 1291 | character. */ | ||
| 1292 | boyer_moore_ok = 0; | ||
| 1293 | break; | ||
| 1294 | } | ||
| 1295 | else if (charset_base < 0) | ||
| 1296 | charset_base = inverse & ~CHAR_FIELD3_MASK; | ||
| 1297 | else if ((inverse & ~CHAR_FIELD3_MASK) | ||
| 1298 | != charset_base) | ||
| 1299 | { | ||
| 1300 | boyer_moore_ok = 0; | ||
| 1301 | break; | ||
| 1296 | } | 1302 | } |
| 1297 | if (c == inverse) | 1303 | if (c == inverse) |
| 1298 | break; | 1304 | break; |
| @@ -1300,6 +1306,8 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n, | |||
| 1300 | } | 1306 | } |
| 1301 | } | 1307 | } |
| 1302 | } | 1308 | } |
| 1309 | if (charset_base < 0) | ||
| 1310 | charset_base = 0; | ||
| 1303 | 1311 | ||
| 1304 | /* Store this character into the translated pattern. */ | 1312 | /* Store this character into the translated pattern. */ |
| 1305 | bcopy (str, pat, charlen); | 1313 | bcopy (str, pat, charlen); |