Commit 375fcc09 authored by Karl Heuer's avatar Karl Heuer
Browse files

(print_string): Properly compute number of chars

in multibyte case, before calling strout.
parent 735c094c
......@@ -573,11 +573,24 @@ print_string (string, printcharfun)
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.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment