aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2000-12-14 10:44:56 +0000
committerKenichi Handa2000-12-14 10:44:56 +0000
commita4ef85ee19fd2716607c8eb4ba3b8926a6343217 (patch)
tree2f99e494240dab5458c77d03d49ef85d04172fe4 /src
parent98d62747fd73fdd0d052b074b17510d27d937951 (diff)
downloademacs-a4ef85ee19fd2716607c8eb4ba3b8926a6343217.tar.gz
emacs-a4ef85ee19fd2716607c8eb4ba3b8926a6343217.zip
(echo_prompt): Argument type changed to Lisp_Object.
Always store string in multibyte representation in echobuf. (echo_char): Always store string in multibyte representation in echobuf. (echo_now): Call message2_nolog with the arg MULTIBYTE 1. (read_key_sequence): Adjusted for the change of echo_prompt.
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c50
1 files changed, 40 insertions, 10 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index ae7ad55da38..8fb0a1ec897 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -690,14 +690,35 @@ static int cannot_suspend;
690 690
691void 691void
692echo_prompt (str) 692echo_prompt (str)
693 char *str; 693 Lisp_Object str;
694{ 694{
695 int len = strlen (str); 695 int len = STRING_BYTES (XSTRING (str));
696 int multibyte_p = STRING_MULTIBYTE (str);
696 697
697 if (len > ECHOBUFSIZE - 4) 698 if (len > ECHOBUFSIZE - 4)
698 len = ECHOBUFSIZE - 4; 699 {
699 bcopy (str, current_kboard->echobuf, len); 700 if (multibyte_p)
700 current_kboard->echoptr = current_kboard->echobuf + len; 701 {
702 unsigned char *p = XSTRING (str)->data, *lastp;
703 unsigned char *pend = p + ECHOBUFSIZE - 4;
704
705 while (p < pend)
706 {
707 int this_len;
708
709 lastp = p;
710 PARSE_MULTIBYTE_SEQ (p, pend - p, this_len);
711 p += this_len;
712 }
713 len = lastp - XSTRING (str)->data;
714 }
715 else
716 len = ECHOBUFSIZE - 4;
717 }
718
719 current_kboard->echoptr
720 += copy_text (XSTRING (str)->data, current_kboard->echobuf, len,
721 STRING_MULTIBYTE (str), 1);
701 *current_kboard->echoptr = '\0'; 722 *current_kboard->echoptr = '\0';
702 723
703 current_kboard->echo_after_prompt = len; 724 current_kboard->echo_after_prompt = len;
@@ -727,11 +748,20 @@ echo_char (c)
727 748
728 if (INTEGERP (c)) 749 if (INTEGERP (c))
729 { 750 {
751 int ch = XINT (c);
752
730 if (ptr - current_kboard->echobuf 753 if (ptr - current_kboard->echobuf
731 > ECHOBUFSIZE - KEY_DESCRIPTION_SIZE) 754 > ECHOBUFSIZE - KEY_DESCRIPTION_SIZE)
732 return; 755 return;
733 756
734 ptr = push_key_description (XINT (c), ptr); 757 if (ASCII_BYTE_P (ch))
758 ptr = push_key_description (ch, ptr);
759 else
760 {
761 if (SINGLE_BYTE_CHAR_P (ch))
762 ch = unibyte_char_to_multibyte (ch);
763 ptr += CHAR_STRING (ch, ptr);
764 }
735 } 765 }
736 else if (SYMBOLP (c)) 766 else if (SYMBOLP (c))
737 { 767 {
@@ -739,8 +769,8 @@ echo_char (c)
739 if ((ptr - current_kboard->echobuf) + STRING_BYTES (name) + 4 769 if ((ptr - current_kboard->echobuf) + STRING_BYTES (name) + 4
740 > ECHOBUFSIZE) 770 > ECHOBUFSIZE)
741 return; 771 return;
742 bcopy (name->data, ptr, STRING_BYTES (name)); 772 ptr += copy_text (name->data, ptr, STRING_BYTES (name),
743 ptr += STRING_BYTES (name); 773 name->size_byte >= 0, 1);
744 } 774 }
745 775
746 if (current_kboard->echoptr == current_kboard->echobuf 776 if (current_kboard->echoptr == current_kboard->echobuf
@@ -806,7 +836,7 @@ echo_now ()
806 836
807 echoing = 1; 837 echoing = 1;
808 message2_nolog (current_kboard->echobuf, strlen (current_kboard->echobuf), 838 message2_nolog (current_kboard->echobuf, strlen (current_kboard->echobuf),
809 ! NILP (current_buffer->enable_multibyte_characters)); 839 1);
810 echoing = 0; 840 echoing = 0;
811 841
812 /* Record in what buffer we echoed, and from which kboard. */ 842 /* Record in what buffer we echoed, and from which kboard. */
@@ -7839,7 +7869,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
7839 if (INTERACTIVE) 7869 if (INTERACTIVE)
7840 { 7870 {
7841 if (!NILP (prompt)) 7871 if (!NILP (prompt))
7842 echo_prompt (XSTRING (prompt)->data); 7872 echo_prompt (prompt);
7843 else if (cursor_in_echo_area 7873 else if (cursor_in_echo_area
7844 && (FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes)) 7874 && (FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes))
7845 && NILP (Fzerop (Vecho_keystrokes))) 7875 && NILP (Fzerop (Vecho_keystrokes)))