Mercurial > emacs
comparison src/keyboard.c @ 34856:a79d5c8fdfaf
(echo_prompt): Always set current_kboard->echoptr to
the end of the prompt. Set echo_after_prompt to the offset
of echoptr in echobuf.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Sat, 23 Dec 2000 23:08:42 +0000 |
parents | df58e8203c13 |
children | 19f10425ca8b |
comparison
equal
deleted
inserted
replaced
34855:dbcb6bfb3ddb | 34856:a79d5c8fdfaf |
---|---|
690 | 690 |
691 void | 691 void |
692 echo_prompt (str) | 692 echo_prompt (str) |
693 Lisp_Object str; | 693 Lisp_Object str; |
694 { | 694 { |
695 int len = STRING_BYTES (XSTRING (str)); | 695 int nbytes = STRING_BYTES (XSTRING (str)); |
696 int multibyte_p = STRING_MULTIBYTE (str); | 696 int multibyte_p = STRING_MULTIBYTE (str); |
697 | 697 |
698 if (len > ECHOBUFSIZE - 4) | 698 if (nbytes > ECHOBUFSIZE - 4) |
699 { | 699 { |
700 if (multibyte_p) | 700 if (multibyte_p) |
701 { | 701 { |
702 unsigned char *p = XSTRING (str)->data, *lastp = p; | 702 /* Have to find the last character that fit's into the |
703 echo buffer. */ | |
704 unsigned char *p = XSTRING (str)->data; | |
703 unsigned char *pend = p + ECHOBUFSIZE - 4; | 705 unsigned char *pend = p + ECHOBUFSIZE - 4; |
704 | 706 int char_len; |
705 while (p < pend) | 707 |
708 do | |
706 { | 709 { |
707 int this_len; | 710 PARSE_MULTIBYTE_SEQ (p, pend - p, char_len); |
708 | 711 p += char_len; |
709 lastp = p; | |
710 PARSE_MULTIBYTE_SEQ (p, pend - p, this_len); | |
711 p += this_len; | |
712 } | 712 } |
713 len = lastp - XSTRING (str)->data; | 713 while (p < pend); |
714 | |
715 nbytes = p - XSTRING (str)->data - char_len; | |
714 } | 716 } |
715 else | 717 else |
716 len = ECHOBUFSIZE - 4; | 718 nbytes = ECHOBUFSIZE - 4; |
717 } | 719 } |
718 | 720 |
719 current_kboard->echoptr | 721 nbytes = copy_text (XSTRING (str)->data, current_kboard->echobuf, nbytes, |
720 += copy_text (XSTRING (str)->data, current_kboard->echobuf, len, | 722 STRING_MULTIBYTE (str), 1); |
721 STRING_MULTIBYTE (str), 1); | 723 current_kboard->echoptr = current_kboard->echobuf + nbytes; |
722 *current_kboard->echoptr = '\0'; | 724 *current_kboard->echoptr = '\0'; |
723 | 725 current_kboard->echo_after_prompt = nbytes; |
724 current_kboard->echo_after_prompt = len; | |
725 | 726 |
726 echo_now (); | 727 echo_now (); |
727 } | 728 } |
728 | 729 |
729 /* Add C to the echo string, if echoing is going on. | 730 /* Add C to the echo string, if echoing is going on. |