aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa1998-12-22 06:06:48 +0000
committerKenichi Handa1998-12-22 06:06:48 +0000
commit9a4d01d85c90edb9b0e6360a34558b0ae1d6e21b (patch)
tree880bf9dab2a191860af8495c7287b2bb0ed66cd0 /src
parent51c6067d9b84d32e0ef3b572600c0c9576f497d7 (diff)
downloademacs-9a4d01d85c90edb9b0e6360a34558b0ae1d6e21b.tar.gz
emacs-9a4d01d85c90edb9b0e6360a34558b0ae1d6e21b.zip
(printchar): Fix previous change.
Diffstat (limited to 'src')
-rw-r--r--src/print.c54
1 files changed, 34 insertions, 20 deletions
diff --git a/src/print.c b/src/print.c
index 9b24f989830..7087096fb20 100644
--- a/src/print.c
+++ b/src/print.c
@@ -413,34 +413,48 @@ printchar (ch, fun)
413 } 413 }
414 } 414 }
415 415
416 if (len == 1
417 && ! NILP (current_buffer->enable_multibyte_characters)
418 && ! CHAR_HEAD_P (*str))
419 {
420 /* Convert the unibyte character to multibyte. */
421 unsigned char c = *str;
422
423 len = count_size_as_multibyte (&c, 1);
424 copy_text (&c, work, 1, 0, 1);
425 str = work;
426 }
427
416 message_dolog (str, len, 0, len > 1); 428 message_dolog (str, len, 0, len > 1);
417 429
418 /* Convert message to multibyte if we are now adding multibyte text. */
419 if (! NILP (current_buffer->enable_multibyte_characters) 430 if (! NILP (current_buffer->enable_multibyte_characters)
420 && ! message_enable_multibyte 431 && ! message_enable_multibyte)
421 && printbufidx > 0)
422 { 432 {
423 int size = count_size_as_multibyte (FRAME_MESSAGE_BUF (mini_frame), 433 /* Record that the message buffer is multibyte. */
424 printbufidx); 434 message_enable_multibyte = 1;
425 unsigned char *tembuf = (unsigned char *) alloca (size + 1); 435
426 copy_text (FRAME_MESSAGE_BUF (mini_frame), tembuf, printbufidx, 436 /* If we have already had some message text in the messsage
427 0, 1); 437 buffer, we convert it to multibyte. */
428 printbufidx = size; 438 if (printbufidx > 0)
429 if (printbufidx > FRAME_MESSAGE_BUF_SIZE (mini_frame))
430 { 439 {
431 printbufidx = FRAME_MESSAGE_BUF_SIZE (mini_frame); 440 int size
432 /* Rewind incomplete multi-byte form. */ 441 = count_size_as_multibyte (FRAME_MESSAGE_BUF (mini_frame),
433 while (printbufidx > 0 && tembuf[printbufidx] >= 0xA0) 442 printbufidx);
434 printbufidx--; 443 unsigned char *tembuf = (unsigned char *) alloca (size + 1);
444 copy_text (FRAME_MESSAGE_BUF (mini_frame), tembuf, printbufidx,
445 0, 1);
446 printbufidx = size;
447 if (printbufidx > FRAME_MESSAGE_BUF_SIZE (mini_frame))
448 {
449 printbufidx = FRAME_MESSAGE_BUF_SIZE (mini_frame);
450 /* Rewind incomplete multi-byte form. */
451 while (printbufidx > 0 && tembuf[printbufidx] >= 0xA0)
452 printbufidx--;
453 }
454 bcopy (tembuf, FRAME_MESSAGE_BUF (mini_frame), printbufidx);
435 } 455 }
436 bcopy (tembuf, FRAME_MESSAGE_BUF (mini_frame), printbufidx);
437 } 456 }
438 457
439 /* Record whether the message buffer is multibyte.
440 (If at any point some multibyte characters are added, then it is.) */
441 if (len > 0 && ! NILP (current_buffer->enable_multibyte_characters))
442 message_enable_multibyte = 1;
443
444 if (printbufidx < FRAME_MESSAGE_BUF_SIZE (mini_frame) - len) 458 if (printbufidx < FRAME_MESSAGE_BUF_SIZE (mini_frame) - len)
445 { 459 {
446 bcopy (str, &FRAME_MESSAGE_BUF (mini_frame)[printbufidx], len); 460 bcopy (str, &FRAME_MESSAGE_BUF (mini_frame)[printbufidx], len);