aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKarl Heuer <[email protected]>1998-06-22 17:39:25 +0000
committerKarl Heuer <[email protected]>1998-06-22 17:39:25 +0000
commit375fcc095fc5a4417fed9cbe2816db214350513b (patch)
treeceffd79c2931bad2f43fe06cd6987d5aa2edce33 /src
parent735c094c0e9401e11913bf8841bdbde1c6ea902d (diff)
(print_string): Properly compute number of chars
in multibyte case, before calling strout.
Diffstat (limited to 'src')
-rw-r--r--src/print.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/print.c b/src/print.c
index e60cdfb2ff..8df254c405 100644
--- a/src/print.c
+++ b/src/print.c
@@ -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.