diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/minibuf.c | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/src/minibuf.c b/src/minibuf.c index 89ea801b1db..0db5e62677a 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -23,6 +23,7 @@ Boston, MA 02111-1307, USA. */ | |||
| 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" |
| @@ -322,7 +323,7 @@ read_minibuf (map, initial, prompt, backup_n, expflag, histvar, histpos) | |||
| 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; |
| @@ -921,6 +922,7 @@ scmp (s1, s2, len) | |||
| 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 | { |
| @@ -935,7 +937,15 @@ scmp (s1, s2, len) | |||
| 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, |
| @@ -1536,13 +1546,22 @@ Return nil if there is no valid completion, else t.") | |||
| 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. */ |
| 1549 | { | ||
| 1550 | int len, c; | ||
| 1539 | 1551 | ||
| 1540 | completion_string = XSTRING (completion)->data; | 1552 | completion_string = XSTRING (completion)->data; |
| 1541 | 1553 | for (; i < XSTRING (completion)->size; i += len) | |
| 1542 | for (; i < XSTRING (completion)->size; i++) | 1554 | { |
| 1543 | if (SYNTAX (completion_string[i]) != Sword) break; | 1555 | c = STRING_CHAR_AND_LENGTH (completion_string + i, |
| 1544 | if (i < XSTRING (completion)->size) | 1556 | XSTRING (completion)->size - i, |
| 1545 | i = i + 1; | 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 | ||