changeset 23931:5fea9ce6601a

(printchar): Fix previous change.
author Kenichi Handa <handa@m17n.org>
date Tue, 22 Dec 1998 06:06:48 +0000
parents a9f9015b5b83
children 08e1d4876918
files src/print.c
diffstat 1 files changed, 34 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- 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);