]> git.eshelyaron.com Git - emacs.git/commitdiff
(printchar): Fix previous change.
authorKenichi Handa <handa@m17n.org>
Tue, 22 Dec 1998 06:06:48 +0000 (06:06 +0000)
committerKenichi Handa <handa@m17n.org>
Tue, 22 Dec 1998 06:06:48 +0000 (06:06 +0000)
src/print.c

index 9b24f9898305c550248eb8323217a8e65b714c2f..7087096fb20b025b746bf55328c9a453bff91712 100644 (file)
@@ -413,34 +413,48 @@ printchar (ch, fun)
            }
        }
 
+      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);