Mercurial > emacs
changeset 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 | 32cfe5058f27 |
children | 5d3f50b4c8d2 |
files | src/print.c |
diffstat | 1 files changed, 18 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/print.c Mon Jun 22 17:35:41 1998 +0000 +++ b/src/print.c Mon Jun 22 17:39:25 1998 +0000 @@ -573,11 +573,24 @@ Lisp_Object printcharfun; { if (EQ (printcharfun, Qt) || NILP (printcharfun)) - /* strout is safe for output to a frame (echo area) or to print_buffer. */ - strout (XSTRING (string)->data, - XSTRING (string)->size, - STRING_BYTES (XSTRING (string)), - printcharfun, STRING_MULTIBYTE (string)); + { + int chars; + + if (STRING_MULTIBYTE (string)) + chars = XSTRING (string)->size; + else if (EQ (printcharfun, Qt) + ? ! NILP (buffer_defaults.enable_multibyte_characters) + : ! NILP (current_buffer->enable_multibyte_characters)) + chars = multibyte_chars_in_text (XSTRING (string)->data, + STRING_BYTES (XSTRING (string))); + else + chars = STRING_BYTES (XSTRING (string)); + + /* strout is safe for output to a frame (echo area) or to print_buffer. */ + strout (XSTRING (string)->data, + chars, STRING_BYTES (XSTRING (string)), + printcharfun, STRING_MULTIBYTE (string)); + } else { /* Otherwise, string may be relocated by printing one char.