diff options
| author | Gerd Moellmann | 2002-03-08 11:34:25 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2002-03-08 11:34:25 +0000 |
| commit | 0d121f7c6a7f2c60bf73e66ef63667b35ab43840 (patch) | |
| tree | 413ae3bba5c7a140a5c7b9e7504fad1db0cde641 /src | |
| parent | 2051c264a322b8227eac662889f99d1f14a9c384 (diff) | |
| download | emacs-0d121f7c6a7f2c60bf73e66ef63667b35ab43840.tar.gz emacs-0d121f7c6a7f2c60bf73e66ef63667b35ab43840.zip | |
(echo_char): Make sure to add a separator between
keys even if echo_dash hasn't been called.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 3 | ||||
| -rw-r--r-- | src/keyboard.c | 45 |
2 files changed, 30 insertions, 18 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 7bca6d71d4b..3504fa76084 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | 2002-03-08 Gerd Moellmann <gerd@gnu.org> | 1 | 2002-03-08 Gerd Moellmann <gerd@gnu.org> |
| 2 | 2 | ||
| 3 | * keyboard.c (echo_char): Make sure to add a separator between | ||
| 4 | keys even if echo_dash hasn't been called. | ||
| 5 | |||
| 3 | * xdisp.c: Use new string macros. | 6 | * xdisp.c: Use new string macros. |
| 4 | (update_echo_area): Pass number of bytes to message3 instead of | 7 | (update_echo_area): Pass number of bytes to message3 instead of |
| 5 | number of chars. | 8 | number of chars. |
diff --git a/src/keyboard.c b/src/keyboard.c index 8187659c818..72a7e8c0af1 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -707,7 +707,7 @@ echo_prompt (str) | |||
| 707 | Lisp_Object str; | 707 | Lisp_Object str; |
| 708 | { | 708 | { |
| 709 | current_kboard->echo_string = str; | 709 | current_kboard->echo_string = str; |
| 710 | current_kboard->echo_after_prompt = XSTRING (str)->size; | 710 | current_kboard->echo_after_prompt = SCHARS (str); |
| 711 | echo_now (); | 711 | echo_now (); |
| 712 | } | 712 | } |
| 713 | 713 | ||
| @@ -726,6 +726,8 @@ echo_char (c) | |||
| 726 | char *ptr = buffer; | 726 | char *ptr = buffer; |
| 727 | Lisp_Object echo_string; | 727 | Lisp_Object echo_string; |
| 728 | 728 | ||
| 729 | echo_string = current_kboard->echo_string; | ||
| 730 | |||
| 729 | /* If someone has passed us a composite event, use its head symbol. */ | 731 | /* If someone has passed us a composite event, use its head symbol. */ |
| 730 | c = EVENT_HEAD (c); | 732 | c = EVENT_HEAD (c); |
| 731 | 733 | ||
| @@ -736,21 +738,21 @@ echo_char (c) | |||
| 736 | else if (SYMBOLP (c)) | 738 | else if (SYMBOLP (c)) |
| 737 | { | 739 | { |
| 738 | struct Lisp_String *name = XSYMBOL (c)->name; | 740 | struct Lisp_String *name = XSYMBOL (c)->name; |
| 741 | int nbytes = STRING_BYTES (name); | ||
| 739 | 742 | ||
| 740 | if (size - (ptr - buffer) < STRING_BYTES (name)) | 743 | if (size - (ptr - buffer) < nbytes) |
| 741 | { | 744 | { |
| 742 | int offset = ptr - buffer; | 745 | int offset = ptr - buffer; |
| 743 | size = max (2 * size, size + STRING_BYTES (name)); | 746 | size = max (2 * size, size + nbytes); |
| 744 | buffer = (char *) alloca (size); | 747 | buffer = (char *) alloca (size); |
| 745 | ptr = buffer + offset; | 748 | ptr = buffer + offset; |
| 746 | } | 749 | } |
| 747 | 750 | ||
| 748 | ptr += copy_text (name->data, ptr, STRING_BYTES (name), | 751 | ptr += copy_text (name->data, ptr, nbytes, |
| 749 | name->size_byte >= 0, 1); | 752 | name->size_byte >= 0, 1); |
| 750 | } | 753 | } |
| 751 | 754 | ||
| 752 | if ((NILP (current_kboard->echo_string) | 755 | if ((NILP (echo_string) || SCHARS (echo_string) == 0) |
| 753 | || XSTRING (current_kboard->echo_string)->size == 0) | ||
| 754 | && help_char_p (c)) | 756 | && help_char_p (c)) |
| 755 | { | 757 | { |
| 756 | const char *text = " (Type ? for further options)"; | 758 | const char *text = " (Type ? for further options)"; |
| @@ -768,14 +770,21 @@ echo_char (c) | |||
| 768 | ptr += len; | 770 | ptr += len; |
| 769 | } | 771 | } |
| 770 | 772 | ||
| 771 | echo_string = current_kboard->echo_string; | 773 | /* Replace a dash from echo_dash with a space, otherwise |
| 772 | 774 | add a space at the end as a separator between keys. */ | |
| 773 | /* Replace a dash from echo_dash with a space. */ | ||
| 774 | if (STRINGP (echo_string) | 775 | if (STRINGP (echo_string) |
| 775 | && (size = STRING_BYTES (XSTRING (echo_string)), | 776 | && SCHARS (echo_string) > 0) |
| 776 | (size > 0 | 777 | { |
| 777 | && XSTRING (echo_string)->data[size - 1] == '-'))) | 778 | Lisp_Object last_char, idx; |
| 778 | XSTRING (echo_string)->data[size - 1] = ' '; | 779 | |
| 780 | idx = make_number (SCHARS (echo_string) - 1); | ||
| 781 | last_char = Faref (echo_string, idx); | ||
| 782 | |||
| 783 | if (XINT (last_char) == '-') | ||
| 784 | Faset (echo_string, idx, make_number (' ')); | ||
| 785 | else | ||
| 786 | echo_string = concat2 (echo_string, build_string (" ")); | ||
| 787 | } | ||
| 779 | 788 | ||
| 780 | current_kboard->echo_string | 789 | current_kboard->echo_string |
| 781 | = concat2 (echo_string, make_string (buffer, ptr - buffer)); | 790 | = concat2 (echo_string, make_string (buffer, ptr - buffer)); |
| @@ -795,12 +804,12 @@ echo_dash () | |||
| 795 | return; | 804 | return; |
| 796 | 805 | ||
| 797 | if (!current_kboard->immediate_echo | 806 | if (!current_kboard->immediate_echo |
| 798 | && XSTRING (current_kboard->echo_string)->size == 0) | 807 | && SCHARS (current_kboard->echo_string) == 0) |
| 799 | return; | 808 | return; |
| 800 | 809 | ||
| 801 | /* Do nothing if we just printed a prompt. */ | 810 | /* Do nothing if we just printed a prompt. */ |
| 802 | if (current_kboard->echo_after_prompt | 811 | if (current_kboard->echo_after_prompt |
| 803 | == XSTRING (current_kboard->echo_string)->size) | 812 | == SCHARS (current_kboard->echo_string)) |
| 804 | return; | 813 | return; |
| 805 | 814 | ||
| 806 | /* Put a dash at the end of the buffer temporarily, | 815 | /* Put a dash at the end of the buffer temporarily, |
| @@ -834,8 +843,8 @@ echo_now () | |||
| 834 | 843 | ||
| 835 | echoing = 1; | 844 | echoing = 1; |
| 836 | message3_nolog (current_kboard->echo_string, | 845 | message3_nolog (current_kboard->echo_string, |
| 837 | STRING_BYTES (XSTRING (current_kboard->echo_string)), | 846 | SBYTES (current_kboard->echo_string), |
| 838 | STRING_MULTIBYTE (current_kboard->echo_string)); | 847 | SMBP (current_kboard->echo_string)); |
| 839 | echoing = 0; | 848 | echoing = 0; |
| 840 | 849 | ||
| 841 | /* Record in what buffer we echoed, and from which kboard. */ | 850 | /* Record in what buffer we echoed, and from which kboard. */ |
| @@ -865,7 +874,7 @@ static int | |||
| 865 | echo_length () | 874 | echo_length () |
| 866 | { | 875 | { |
| 867 | return (STRINGP (current_kboard->echo_string) | 876 | return (STRINGP (current_kboard->echo_string) |
| 868 | ? XSTRING (current_kboard->echo_string)->size | 877 | ? SCHARS (current_kboard->echo_string) |
| 869 | : 0); | 878 | : 0); |
| 870 | } | 879 | } |
| 871 | 880 | ||