diff options
| author | Karl Heuer | 1998-06-22 17:39:25 +0000 |
|---|---|---|
| committer | Karl Heuer | 1998-06-22 17:39:25 +0000 |
| commit | 375fcc095fc5a4417fed9cbe2816db214350513b (patch) | |
| tree | ceffd79c2931bad2f43fe06cd6987d5aa2edce33 /src | |
| parent | 735c094c0e9401e11913bf8841bdbde1c6ea902d (diff) | |
| download | emacs-375fcc095fc5a4417fed9cbe2816db214350513b.tar.gz emacs-375fcc095fc5a4417fed9cbe2816db214350513b.zip | |
(print_string): Properly compute number of chars
in multibyte case, before calling strout.
Diffstat (limited to 'src')
| -rw-r--r-- | src/print.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/print.c b/src/print.c index e60cdfb2fff..8df254c4059 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -573,11 +573,24 @@ print_string (string, printcharfun) | |||
| 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. |