From f717c2baaa18bc06df847b3edd8bc641585fffa4 Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Sat, 23 Dec 2000 23:09:04 +0000 Subject: [PATCH] (echo_prompt): Always set current_kboard->echoptr to the end of the prompt. Set echo_after_prompt to the offset of echoptr in echobuf. --- src/ChangeLog | 4 ++++ src/keyboard.c | 33 +++++++++++++++++---------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index c8ff93a44dc..2cffae07790 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2000-12-23 Gerd Moellmann + * keyboard.c (echo_prompt): Always set current_kboard->echoptr to + the end of the prompt. Set echo_after_prompt to the offset + of echoptr in echobuf. + * xdisp.c (init_from_display_pos): Pop until the iterator's stack is empty; there may be frames for stretch or images on the stack. 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 echo_prompt (str) Lisp_Object str; { - int len = STRING_BYTES (XSTRING (str)); + int nbytes = STRING_BYTES (XSTRING (str)); int multibyte_p = STRING_MULTIBYTE (str); - if (len > ECHOBUFSIZE - 4) + if (nbytes > ECHOBUFSIZE - 4) { if (multibyte_p) { - unsigned char *p = XSTRING (str)->data, *lastp = p; + /* Have to find the last character that fit's into the + echo buffer. */ + unsigned char *p = XSTRING (str)->data; unsigned char *pend = p + ECHOBUFSIZE - 4; + int char_len; - while (p < pend) + do { - int this_len; - - lastp = p; - PARSE_MULTIBYTE_SEQ (p, pend - p, this_len); - p += this_len; + PARSE_MULTIBYTE_SEQ (p, pend - p, char_len); + p += char_len; } - len = lastp - XSTRING (str)->data; + while (p < pend); + + nbytes = p - XSTRING (str)->data - char_len; } else - len = ECHOBUFSIZE - 4; + nbytes = ECHOBUFSIZE - 4; } - current_kboard->echoptr - += copy_text (XSTRING (str)->data, current_kboard->echobuf, len, - STRING_MULTIBYTE (str), 1); + nbytes = copy_text (XSTRING (str)->data, current_kboard->echobuf, nbytes, + STRING_MULTIBYTE (str), 1); + current_kboard->echoptr = current_kboard->echobuf + nbytes; *current_kboard->echoptr = '\0'; - - current_kboard->echo_after_prompt = len; + current_kboard->echo_after_prompt = nbytes; echo_now (); } -- 2.39.2