Mercurial > emacs
comparison src/minibuf.c @ 17039:b63ed55bed46
Include charset.h.
(read_minibuf): Pay attention to multibyte characters in the arg
INITIAL while handling the arg BACKUP_N.
(scmp, Fminibuffer_complete_word): Handle multibyte characters.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Thu, 20 Feb 1997 06:52:47 +0000 |
parents | b33fd17a2873 |
children | b3227e0446cf |
comparison
equal
deleted
inserted
replaced
17038:f7a1e78fe210 | 17039:b63ed55bed46 |
---|---|
21 | 21 |
22 #include <config.h> | 22 #include <config.h> |
23 #include "lisp.h" | 23 #include "lisp.h" |
24 #include "commands.h" | 24 #include "commands.h" |
25 #include "buffer.h" | 25 #include "buffer.h" |
26 #include "charset.h" | |
26 #include "dispextern.h" | 27 #include "dispextern.h" |
27 #include "frame.h" | 28 #include "frame.h" |
28 #include "window.h" | 29 #include "window.h" |
29 #include "syntax.h" | 30 #include "syntax.h" |
30 #include "keyboard.h" | 31 #include "keyboard.h" |
320 /* Put in the initial input. */ | 321 /* Put in the initial input. */ |
321 if (!NILP (initial)) | 322 if (!NILP (initial)) |
322 { | 323 { |
323 Finsert (1, &initial); | 324 Finsert (1, &initial); |
324 if (!NILP (backup_n) && INTEGERP (backup_n)) | 325 if (!NILP (backup_n) && INTEGERP (backup_n)) |
325 Fforward_char (backup_n); | 326 Fgoto_char (make_number (PT + XFASTINT (backup_n))); |
326 } | 327 } |
327 | 328 |
328 echo_area_glyphs = 0; | 329 echo_area_glyphs = 0; |
329 /* This is in case the minibuffer-setup-hook calls Fsit_for. */ | 330 /* This is in case the minibuffer-setup-hook calls Fsit_for. */ |
330 previous_echo_glyphs = 0; | 331 previous_echo_glyphs = 0; |
919 scmp (s1, s2, len) | 920 scmp (s1, s2, len) |
920 register unsigned char *s1, *s2; | 921 register unsigned char *s1, *s2; |
921 int len; | 922 int len; |
922 { | 923 { |
923 register int l = len; | 924 register int l = len; |
925 register unsigned char *start = s1; | |
924 | 926 |
925 if (completion_ignore_case) | 927 if (completion_ignore_case) |
926 { | 928 { |
927 while (l && DOWNCASE (*s1++) == DOWNCASE (*s2++)) | 929 while (l && DOWNCASE (*s1++) == DOWNCASE (*s2++)) |
928 l--; | 930 l--; |
933 l--; | 935 l--; |
934 } | 936 } |
935 if (l == 0) | 937 if (l == 0) |
936 return -1; | 938 return -1; |
937 else | 939 else |
938 return len - l; | 940 { |
941 int match = len - l; | |
942 | |
943 /* Now *--S1 is the unmatching byte. If it is in the middle of | |
944 multi-byte form, we must say that the multi-byte character | |
945 there doesn't match. */ | |
946 while (match && *--s1 >= 0xA0) match--; | |
947 return match; | |
948 } | |
939 } | 949 } |
940 | 950 |
941 DEFUN ("all-completions", Fall_completions, Sall_completions, 2, 4, 0, | 951 DEFUN ("all-completions", Fall_completions, Sall_completions, 2, 4, 0, |
942 "Search for partial matches to STRING in ALIST.\n\ | 952 "Search for partial matches to STRING in ALIST.\n\ |
943 Each car of each element of ALIST is tested to see if it begins with STRING.\n\ | 953 Each car of each element of ALIST is tested to see if it begins with STRING.\n\ |
1534 } | 1544 } |
1535 } | 1545 } |
1536 | 1546 |
1537 /* Now find first word-break in the stuff found by completion. | 1547 /* Now find first word-break in the stuff found by completion. |
1538 i gets index in string of where to stop completing. */ | 1548 i gets index in string of where to stop completing. */ |
1539 | 1549 { |
1540 completion_string = XSTRING (completion)->data; | 1550 int len, c; |
1541 | 1551 |
1542 for (; i < XSTRING (completion)->size; i++) | 1552 completion_string = XSTRING (completion)->data; |
1543 if (SYNTAX (completion_string[i]) != Sword) break; | 1553 for (; i < XSTRING (completion)->size; i += len) |
1544 if (i < XSTRING (completion)->size) | 1554 { |
1545 i = i + 1; | 1555 c = STRING_CHAR_AND_LENGTH (completion_string + i, |
1556 XSTRING (completion)->size - i, | |
1557 len); | |
1558 if (SYNTAX (c) != Sword) | |
1559 { | |
1560 i += len; | |
1561 break; | |
1562 } | |
1563 } | |
1564 } | |
1546 | 1565 |
1547 /* If got no characters, print help for user. */ | 1566 /* If got no characters, print help for user. */ |
1548 | 1567 |
1549 if (i == ZV - BEGV) | 1568 if (i == ZV - BEGV) |
1550 { | 1569 { |