diff options
| author | Gerd Moellmann | 2000-12-23 23:09:04 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-12-23 23:09:04 +0000 |
| commit | f717c2baaa18bc06df847b3edd8bc641585fffa4 (patch) | |
| tree | 4d8dc16ffeddbff9553ab8d7b48d59dd5939e0c6 /src/keyboard.c | |
| parent | 83f40583a465070db49db28c76d344691acc0f3c (diff) | |
| download | emacs-f717c2baaa18bc06df847b3edd8bc641585fffa4.tar.gz emacs-f717c2baaa18bc06df847b3edd8bc641585fffa4.zip | |
(echo_prompt): Always set current_kboard->echoptr to
the end of the prompt. Set echo_after_prompt to the offset
of echoptr in echobuf.
Diffstat (limited to 'src/keyboard.c')
| -rw-r--r-- | src/keyboard.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index d8fc173e7d8..d8c96c82add 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -692,36 +692,37 @@ 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; |
| 706 | int char_len; | ||
| 704 | 707 | ||
| 705 | while (p < pend) | 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 | } |