From c42869c47d6a598ded22d5e929d5388d3b6cb9f3 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Mon, 28 Sep 1998 11:52:53 +0000 Subject: [PATCH] (encode_terminal_code): Handle raw 8-bit codes correctly. --- src/term.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/term.c b/src/term.c index de48cb0eb88..17607cea5d5 100644 --- a/src/term.c +++ b/src/term.c @@ -858,13 +858,19 @@ encode_terminal_code (src, dst, src_len, dst_len, consumed) } encode_coding (coding, buf, dst, len, dst_end - dst); - if (coding->consumed < len) - /* We get a carryover because the remaining output - buffer is too short. We must break the loop here - without increasing SRC so that the next call of - this function start from the same glyph. */ - break; + len -= coding->consumed; dst += coding->produced; + if (len > 0) + { + if (len > dst_end - dst) + /* The remaining output buffer is too short. We must + break the loop here without increasing SRC so that + the next call of this function start from the same + glyph. */ + break; + buf += len; + while (len--) *dst++ = *buf++; + } } src++; } -- 2.39.2