# HG changeset patch # User Kenichi Handa # Date 914306808 0 # Node ID 5fea9ce6601a29f3c00cca32130969de8da11f2c # Parent a9f9015b5b8355e6822dede462240878b235cdb3 (printchar): Fix previous change. diff -r a9f9015b5b83 -r 5fea9ce6601a src/print.c --- a/src/print.c Tue Dec 22 06:06:48 1998 +0000 +++ b/src/print.c Tue Dec 22 06:06:48 1998 +0000 @@ -413,34 +413,48 @@ } } + if (len == 1 + && ! NILP (current_buffer->enable_multibyte_characters) + && ! CHAR_HEAD_P (*str)) + { + /* Convert the unibyte character to multibyte. */ + unsigned char c = *str; + + len = count_size_as_multibyte (&c, 1); + copy_text (&c, work, 1, 0, 1); + str = work; + } + message_dolog (str, len, 0, len > 1); - /* Convert message to multibyte if we are now adding multibyte text. */ if (! NILP (current_buffer->enable_multibyte_characters) - && ! message_enable_multibyte - && printbufidx > 0) + && ! message_enable_multibyte) { - int size = count_size_as_multibyte (FRAME_MESSAGE_BUF (mini_frame), - printbufidx); - unsigned char *tembuf = (unsigned char *) alloca (size + 1); - copy_text (FRAME_MESSAGE_BUF (mini_frame), tembuf, printbufidx, - 0, 1); - printbufidx = size; - if (printbufidx > FRAME_MESSAGE_BUF_SIZE (mini_frame)) + /* Record that the message buffer is multibyte. */ + message_enable_multibyte = 1; + + /* If we have already had some message text in the messsage + buffer, we convert it to multibyte. */ + if (printbufidx > 0) { - printbufidx = FRAME_MESSAGE_BUF_SIZE (mini_frame); - /* Rewind incomplete multi-byte form. */ - while (printbufidx > 0 && tembuf[printbufidx] >= 0xA0) - printbufidx--; + int size + = count_size_as_multibyte (FRAME_MESSAGE_BUF (mini_frame), + printbufidx); + unsigned char *tembuf = (unsigned char *) alloca (size + 1); + copy_text (FRAME_MESSAGE_BUF (mini_frame), tembuf, printbufidx, + 0, 1); + printbufidx = size; + if (printbufidx > FRAME_MESSAGE_BUF_SIZE (mini_frame)) + { + printbufidx = FRAME_MESSAGE_BUF_SIZE (mini_frame); + /* Rewind incomplete multi-byte form. */ + while (printbufidx > 0 && tembuf[printbufidx] >= 0xA0) + printbufidx--; + } + bcopy (tembuf, FRAME_MESSAGE_BUF (mini_frame), printbufidx); } - bcopy (tembuf, FRAME_MESSAGE_BUF (mini_frame), printbufidx); } - /* Record whether the message buffer is multibyte. - (If at any point some multibyte characters are added, then it is.) */ - if (len > 0 && ! NILP (current_buffer->enable_multibyte_characters)) - message_enable_multibyte = 1; - if (printbufidx < FRAME_MESSAGE_BUF_SIZE (mini_frame) - len) { bcopy (str, &FRAME_MESSAGE_BUF (mini_frame)[printbufidx], len);