diff options
| author | Karl Heuer | 1995-06-11 20:09:49 +0000 |
|---|---|---|
| committer | Karl Heuer | 1995-06-11 20:09:49 +0000 |
| commit | 0a2ea2219a1266af808fb75999267a5d59c13353 (patch) | |
| tree | edf7ad43d6ec9a44b6adce483462509758e93000 /src | |
| parent | 7f77f3c86d920832fe8507a05569e37a3b2793ce (diff) | |
| download | emacs-0a2ea2219a1266af808fb75999267a5d59c13353.tar.gz emacs-0a2ea2219a1266af808fb75999267a5d59c13353.zip | |
(read_char_minibuf_menu_prompt):
If the char to type doesn't match the prompt string,
show the char explicitly.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 102 |
1 files changed, 70 insertions, 32 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index 45b4079d25d..ac5b2090b6d 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -4775,43 +4775,81 @@ read_char_minibuf_menu_prompt (commandflag, nmaps, maps) | |||
| 4775 | else | 4775 | else |
| 4776 | { | 4776 | { |
| 4777 | /* An ordinary element. */ | 4777 | /* An ordinary element. */ |
| 4778 | if ( idx < 0 ) | 4778 | Lisp_Object event; |
| 4779 | s = Fcar_safe (Fcdr_safe (elt)); /* alist */ | 4779 | |
| 4780 | if (idx < 0) | ||
| 4781 | { | ||
| 4782 | s = Fcar_safe (Fcdr_safe (elt)); /* alist */ | ||
| 4783 | event = Fcar_safe (elt); | ||
| 4784 | } | ||
| 4780 | else | 4785 | else |
| 4781 | s = Fcar_safe(elt); /* vector */ | ||
| 4782 | if (!STRINGP (s)) | ||
| 4783 | /* Ignore the element if it has no prompt string. */ | ||
| 4784 | ; | ||
| 4785 | /* If we have room for the prompt string, add it to this line. | ||
| 4786 | If this is the first on the line, always add it. */ | ||
| 4787 | else if (XSTRING (s)->size + i + 2 < width | ||
| 4788 | || !notfirst) | ||
| 4789 | { | 4786 | { |
| 4790 | int thiswidth; | 4787 | s = Fcar_safe (elt); /* vector */ |
| 4788 | XSETINT (event, idx); | ||
| 4789 | } | ||
| 4790 | |||
| 4791 | /* Ignore the element if it has no prompt string. */ | ||
| 4792 | if (STRINGP (s) && INTEGERP (event)) | ||
| 4793 | { | ||
| 4794 | /* 1 if the char to type matches the string. */ | ||
| 4795 | int char_matches; | ||
| 4796 | Lisp_Object upcased_event, downcased_event; | ||
| 4797 | Lisp_Object desc; | ||
| 4798 | |||
| 4799 | upcased_event = Fupcase (event); | ||
| 4800 | downcased_event = Fdowncase (event); | ||
| 4801 | char_matches = (XINT (upcased_event) == XSTRING (s)->data[0] | ||
| 4802 | || XINT (downcased_event) == XSTRING (s)->data[0]); | ||
| 4803 | if (! char_matches) | ||
| 4804 | desc = Fsingle_key_description (event); | ||
| 4805 | |||
| 4806 | /* If we have room for the prompt string, add it to this line. | ||
| 4807 | If this is the first on the line, always add it. */ | ||
| 4808 | if ((XSTRING (s)->size + i + 2 | ||
| 4809 | + (char_matches ? 0 : XSTRING (desc)->size + 3)) | ||
| 4810 | < width | ||
| 4811 | || !notfirst) | ||
| 4812 | { | ||
| 4813 | int thiswidth; | ||
| 4814 | |||
| 4815 | /* Punctuate between strings. */ | ||
| 4816 | if (notfirst) | ||
| 4817 | { | ||
| 4818 | strcpy (menu + i, ", "); | ||
| 4819 | i += 2; | ||
| 4820 | } | ||
| 4821 | notfirst = 1; | ||
| 4822 | nobindings = 0 ; | ||
| 4791 | 4823 | ||
| 4792 | /* Punctuate between strings. */ | 4824 | /* If the char to type doesn't match the string's |
| 4793 | if (notfirst) | 4825 | first char, explicitly show what char to type. */ |
| 4826 | if (! char_matches) | ||
| 4827 | { | ||
| 4828 | /* Add as much of string as fits. */ | ||
| 4829 | thiswidth = XSTRING (desc)->size; | ||
| 4830 | if (thiswidth + i > width) | ||
| 4831 | thiswidth = width - i; | ||
| 4832 | bcopy (XSTRING (desc)->data, menu + i, thiswidth); | ||
| 4833 | i += thiswidth; | ||
| 4834 | strcpy (menu + i, " = "); | ||
| 4835 | i += 3; | ||
| 4836 | } | ||
| 4837 | |||
| 4838 | /* Add as much of string as fits. */ | ||
| 4839 | thiswidth = XSTRING (s)->size; | ||
| 4840 | if (thiswidth + i > width) | ||
| 4841 | thiswidth = width - i; | ||
| 4842 | bcopy (XSTRING (s)->data, menu + i, thiswidth); | ||
| 4843 | i += thiswidth; | ||
| 4844 | menu[i] = 0; | ||
| 4845 | } | ||
| 4846 | else | ||
| 4794 | { | 4847 | { |
| 4795 | strcpy (menu + i, ", "); | 4848 | /* If this element does not fit, end the line now, |
| 4796 | i += 2; | 4849 | and save the element for the next line. */ |
| 4850 | strcpy (menu + i, "..."); | ||
| 4851 | break; | ||
| 4797 | } | 4852 | } |
| 4798 | notfirst = 1; | ||
| 4799 | nobindings = 0 ; | ||
| 4800 | |||
| 4801 | /* Add as much of string as fits. */ | ||
| 4802 | thiswidth = XSTRING (s)->size; | ||
| 4803 | if (thiswidth + i > width) | ||
| 4804 | thiswidth = width - i; | ||
| 4805 | bcopy (XSTRING (s)->data, menu + i, thiswidth); | ||
| 4806 | i += thiswidth; | ||
| 4807 | menu[i] = 0; | ||
| 4808 | } | ||
| 4809 | else | ||
| 4810 | { | ||
| 4811 | /* If this element does not fit, end the line now, | ||
| 4812 | and save the element for the next line. */ | ||
| 4813 | strcpy (menu + i, "..."); | ||
| 4814 | break; | ||
| 4815 | } | 4853 | } |
| 4816 | 4854 | ||
| 4817 | /* Move past this element. */ | 4855 | /* Move past this element. */ |