1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-03 08:30:09 +00:00

(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.
This commit is contained in:
Kenichi Handa 1998-03-25 10:45:59 +00:00
parent f1c87a7d42
commit 0d023da168

View File

@ -2839,7 +2839,9 @@ read_process_output (proc, channel)
return 0;
chars = (char *) XSTRING (p->decoding_buf)->data;
nbytes = coding->produced;
nchars = coding->produced_char;
nchars = (coding->fake_multibyte
? multibyte_chars_in_text (chars, nbytes)
: coding->produced_char);
chars_in_decoding_buf = 1;
}
#ifdef VMS
@ -2848,11 +2850,12 @@ read_process_output (proc, channel)
/* Although we don't have to decode the received data, we must
move it to an area which we don't have to free. */
if (! STRINGP (p->decoding_buf)
|| XSTRING (p->decoding_buf)->size < nbytes)
|| STRING_BYTES (XSTRING (p->decoding_buf)) < nbytes)
p->decoding_buf = make_uninit_string (nbytes);
bcopy (chars, XSTRING (p->decoding_buf)->data, nbytes);
free (chars);
chars = XSTRING (p->decoding_buf)->data;
nchars = multibyte_chars_in_text (chars, nbytes);
chars_in_decoding_buf = 1;
carryover = 0;
}
@ -2976,8 +2979,15 @@ read_process_output (proc, channel)
/* Insert before markers in case we are inserting where
the buffer's mark is, and the user's next command is Meta-y. */
if (chars_in_decoding_buf)
insert_from_string_before_markers (p->decoding_buf, 0, 0,
nchars, nbytes, 0);
{
/* Since multibyteness of p->docoding_buf is corrupted, we
can't use insert_from_string_before_markers. */
char *temp_buf;
temp_buf = (char *) alloca (nbytes);
bcopy (XSTRING (p->decoding_buf)->data, temp_buf, nbytes);
insert_before_markers (temp_buf, nbytes);
}
else
insert_1_both (chars, nchars, nbytes, 0, 1, 1);
set_marker_both (p->mark, p->buffer, PT, PT_BYTE);