diff options
| author | Kenichi Handa | 1998-03-25 10:45:59 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1998-03-25 10:45:59 +0000 |
| commit | 0d023da168b4e8d8ff378bf22b3d9ed8d0e5156b (patch) | |
| tree | 8fc71ebd132e052554b4ac9b3559abf7a4f39333 /src/process.c | |
| parent | f1c87a7d427dc9b74131e5b85e3675fa1320f029 (diff) | |
| download | emacs-0d023da168b4e8d8ff378bf22b3d9ed8d0e5156b.tar.gz emacs-0d023da168b4e8d8ff378bf22b3d9ed8d0e5156b.zip | |
(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.
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/process.c b/src/process.c index 2f26a1a3597..01f5bc9a03d 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -2839,7 +2839,9 @@ read_process_output (proc, channel) | |||
| 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 |
| @@ -2848,11 +2850,12 @@ read_process_output (proc, channel) | |||
| 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 | } |
| @@ -2976,8 +2979,15 @@ read_process_output (proc, channel) | |||
| 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); |