Mercurial > emacs
comparison src/print.c @ 22544:f2d3eeec754e
(print_string): Properly compute number of chars
in multibyte case, before calling strout.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Mon, 22 Jun 1998 17:39:25 +0000 |
parents | 917ec8bf0d89 |
children | c3ffffc994d1 |
comparison
equal
deleted
inserted
replaced
22543:32cfe5058f27 | 22544:f2d3eeec754e |
---|---|
571 print_string (string, printcharfun) | 571 print_string (string, printcharfun) |
572 Lisp_Object string; | 572 Lisp_Object string; |
573 Lisp_Object printcharfun; | 573 Lisp_Object printcharfun; |
574 { | 574 { |
575 if (EQ (printcharfun, Qt) || NILP (printcharfun)) | 575 if (EQ (printcharfun, Qt) || NILP (printcharfun)) |
576 /* strout is safe for output to a frame (echo area) or to print_buffer. */ | 576 { |
577 strout (XSTRING (string)->data, | 577 int chars; |
578 XSTRING (string)->size, | 578 |
579 STRING_BYTES (XSTRING (string)), | 579 if (STRING_MULTIBYTE (string)) |
580 printcharfun, STRING_MULTIBYTE (string)); | 580 chars = XSTRING (string)->size; |
581 else if (EQ (printcharfun, Qt) | |
582 ? ! NILP (buffer_defaults.enable_multibyte_characters) | |
583 : ! NILP (current_buffer->enable_multibyte_characters)) | |
584 chars = multibyte_chars_in_text (XSTRING (string)->data, | |
585 STRING_BYTES (XSTRING (string))); | |
586 else | |
587 chars = STRING_BYTES (XSTRING (string)); | |
588 | |
589 /* strout is safe for output to a frame (echo area) or to print_buffer. */ | |
590 strout (XSTRING (string)->data, | |
591 chars, STRING_BYTES (XSTRING (string)), | |
592 printcharfun, STRING_MULTIBYTE (string)); | |
593 } | |
581 else | 594 else |
582 { | 595 { |
583 /* Otherwise, string may be relocated by printing one char. | 596 /* Otherwise, string may be relocated by printing one char. |
584 So re-fetch the string address for each character. */ | 597 So re-fetch the string address for each character. */ |
585 int i; | 598 int i; |