Mercurial > emacs
comparison src/process.c @ 21281:3763e516cf1e
(read_process_output): Count multibyte characters. If
received data is stored in p->decoding_buf, copy it to a temporary
buffer and call insert_before_makers instead of
insert_from_string_before_markers.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Wed, 25 Mar 1998 10:45:59 +0000 |
parents | f90a51f05bee |
children | aac7354edaed |
comparison
equal
deleted
inserted
replaced
21280:82fbf42bb989 | 21281:3763e516cf1e |
---|---|
2837 #endif | 2837 #endif |
2838 if (coding->produced == 0) | 2838 if (coding->produced == 0) |
2839 return 0; | 2839 return 0; |
2840 chars = (char *) XSTRING (p->decoding_buf)->data; | 2840 chars = (char *) XSTRING (p->decoding_buf)->data; |
2841 nbytes = coding->produced; | 2841 nbytes = coding->produced; |
2842 nchars = coding->produced_char; | 2842 nchars = (coding->fake_multibyte |
2843 ? multibyte_chars_in_text (chars, nbytes) | |
2844 : coding->produced_char); | |
2843 chars_in_decoding_buf = 1; | 2845 chars_in_decoding_buf = 1; |
2844 } | 2846 } |
2845 #ifdef VMS | 2847 #ifdef VMS |
2846 else if (chars_allocated) | 2848 else if (chars_allocated) |
2847 { | 2849 { |
2848 /* Although we don't have to decode the received data, we must | 2850 /* Although we don't have to decode the received data, we must |
2849 move it to an area which we don't have to free. */ | 2851 move it to an area which we don't have to free. */ |
2850 if (! STRINGP (p->decoding_buf) | 2852 if (! STRINGP (p->decoding_buf) |
2851 || XSTRING (p->decoding_buf)->size < nbytes) | 2853 || STRING_BYTES (XSTRING (p->decoding_buf)) < nbytes) |
2852 p->decoding_buf = make_uninit_string (nbytes); | 2854 p->decoding_buf = make_uninit_string (nbytes); |
2853 bcopy (chars, XSTRING (p->decoding_buf)->data, nbytes); | 2855 bcopy (chars, XSTRING (p->decoding_buf)->data, nbytes); |
2854 free (chars); | 2856 free (chars); |
2855 chars = XSTRING (p->decoding_buf)->data; | 2857 chars = XSTRING (p->decoding_buf)->data; |
2858 nchars = multibyte_chars_in_text (chars, nbytes); | |
2856 chars_in_decoding_buf = 1; | 2859 chars_in_decoding_buf = 1; |
2857 carryover = 0; | 2860 carryover = 0; |
2858 } | 2861 } |
2859 #endif | 2862 #endif |
2860 | 2863 |
2974 Fwiden (); | 2977 Fwiden (); |
2975 | 2978 |
2976 /* Insert before markers in case we are inserting where | 2979 /* Insert before markers in case we are inserting where |
2977 the buffer's mark is, and the user's next command is Meta-y. */ | 2980 the buffer's mark is, and the user's next command is Meta-y. */ |
2978 if (chars_in_decoding_buf) | 2981 if (chars_in_decoding_buf) |
2979 insert_from_string_before_markers (p->decoding_buf, 0, 0, | 2982 { |
2980 nchars, nbytes, 0); | 2983 /* Since multibyteness of p->docoding_buf is corrupted, we |
2984 can't use insert_from_string_before_markers. */ | |
2985 char *temp_buf; | |
2986 | |
2987 temp_buf = (char *) alloca (nbytes); | |
2988 bcopy (XSTRING (p->decoding_buf)->data, temp_buf, nbytes); | |
2989 insert_before_markers (temp_buf, nbytes); | |
2990 } | |
2981 else | 2991 else |
2982 insert_1_both (chars, nchars, nbytes, 0, 1, 1); | 2992 insert_1_both (chars, nchars, nbytes, 0, 1, 1); |
2983 set_marker_both (p->mark, p->buffer, PT, PT_BYTE); | 2993 set_marker_both (p->mark, p->buffer, PT, PT_BYTE); |
2984 | 2994 |
2985 update_mode_lines++; | 2995 update_mode_lines++; |