diff options
| author | Kenichi Handa | 1997-08-10 04:13:19 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1997-08-10 04:13:19 +0000 |
| commit | df8bf431475c03421fe9ca360031923be101f1c5 (patch) | |
| tree | 651408bf426dce0b9deccaa01146975a611c9efb /src | |
| parent | f64a355ce069502069596b742b0d9d8312581dd2 (diff) | |
| download | emacs-df8bf431475c03421fe9ca360031923be101f1c5.tar.gz emacs-df8bf431475c03421fe9ca360031923be101f1c5.zip | |
(encode_terminal_code): Use safe_terminal_coding if
terminal_coding seems to encode Emacs' internal code as is.
(write_glyphs): Likewise.
Diffstat (limited to 'src')
| -rw-r--r-- | src/term.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/src/term.c b/src/term.c index efed87e52ea..dd1c8be804e 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -828,8 +828,14 @@ encode_terminal_code (src, dst, src_len, dst_len, consumed) | |||
| 828 | buf = GLYPH_STRING (tbase, g); | 828 | buf = GLYPH_STRING (tbase, g); |
| 829 | } | 829 | } |
| 830 | 830 | ||
| 831 | produced = encode_coding (&terminal_coding, buf, dst, | 831 | if (CODING_MAY_REQUIRE_NO_CONVERSION (&terminal_coding)) |
| 832 | len, dst_end - dst, &processed); | 832 | /* We had better avoid sending Emacs' internal code to |
| 833 | terminal. */ | ||
| 834 | produced = encode_coding (&safe_terminal_coding, buf, dst, | ||
| 835 | len, dst_end - dst, &processed); | ||
| 836 | else | ||
| 837 | produced = encode_coding (&terminal_coding, buf, dst, | ||
| 838 | len, dst_end - dst, &processed); | ||
| 833 | if (processed < len) | 839 | if (processed < len) |
| 834 | /* We get a carryover because the remaining output | 840 | /* We get a carryover because the remaining output |
| 835 | buffer is too short. We must break the loop here | 841 | buffer is too short. We must break the loop here |
| @@ -897,17 +903,21 @@ write_glyphs (string, len) | |||
| 897 | string += consumed; | 903 | string += consumed; |
| 898 | } | 904 | } |
| 899 | /* We may have to output some codes to terminate the writing. */ | 905 | /* We may have to output some codes to terminate the writing. */ |
| 900 | terminal_coding.last_block = 1; | 906 | if (!CODING_MAY_REQUIRE_NO_CONVERSION (&terminal_coding)) |
| 901 | produced = encode_coding (&terminal_coding, (char *)0, conversion_buffer, | ||
| 902 | 0, conversion_buffer_size, | ||
| 903 | &consumed); | ||
| 904 | if (produced > 0) | ||
| 905 | { | 907 | { |
| 906 | fwrite (conversion_buffer, 1, produced, stdout); | 908 | terminal_coding.last_block = 1; |
| 907 | if (ferror (stdout)) | 909 | produced = encode_coding (&terminal_coding, (char *)0, conversion_buffer, |
| 908 | clearerr (stdout); | 910 | 0, conversion_buffer_size, |
| 909 | if (termscript) | 911 | &consumed); |
| 910 | fwrite (conversion_buffer, 1, produced, termscript); | 912 | |
| 913 | if (produced > 0) | ||
| 914 | { | ||
| 915 | fwrite (conversion_buffer, 1, produced, stdout); | ||
| 916 | if (ferror (stdout)) | ||
| 917 | clearerr (stdout); | ||
| 918 | if (termscript) | ||
| 919 | fwrite (conversion_buffer, 1, produced, termscript); | ||
| 920 | } | ||
| 911 | } | 921 | } |
| 912 | cmcheckmagic (); | 922 | cmcheckmagic (); |
| 913 | } | 923 | } |