comparison src/term.c @ 19277:7ea957cd48e2

(encode_terminal_code): Use safe_terminal_coding if terminal_coding seems to encode Emacs' internal code as is. (write_glyphs): Likewise.
author Kenichi Handa <handa@m17n.org>
date Sun, 10 Aug 1997 04:13:19 +0000
parents 0b4c1d43cb95
children 8f58b5d12021
comparison
equal deleted inserted replaced
19276:b2c5e1bea50e 19277:7ea957cd48e2
826 /* We have a string in Vglyph_table. */ 826 /* We have a string in Vglyph_table. */
827 len = GLYPH_LENGTH (tbase, g); 827 len = GLYPH_LENGTH (tbase, g);
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
836 without increasing SRC so that the next call of 842 without increasing SRC so that the next call of
837 this function start from the same glyph. */ 843 this function start from the same glyph. */
895 } 901 }
896 len -= consumed; 902 len -= consumed;
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, 907 {
902 0, conversion_buffer_size, 908 terminal_coding.last_block = 1;
903 &consumed); 909 produced = encode_coding (&terminal_coding, (char *)0, conversion_buffer,
904 if (produced > 0) 910 0, conversion_buffer_size,
905 { 911 &consumed);
906 fwrite (conversion_buffer, 1, produced, stdout); 912
907 if (ferror (stdout)) 913 if (produced > 0)
908 clearerr (stdout); 914 {
909 if (termscript) 915 fwrite (conversion_buffer, 1, produced, stdout);
910 fwrite (conversion_buffer, 1, produced, termscript); 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 }
914 924
915 /* If start is zero, insert blanks instead of a string at start */ 925 /* If start is zero, insert blanks instead of a string at start */