summaryrefslogtreecommitdiff
path: root/src/term.c
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>1999-02-05 05:40:27 +0000
committerKenichi Handa <handa@m17n.org>1999-02-05 05:40:27 +0000
commitf3ac545f7d2d71eaa31f1a56f729a428f94e71d2 (patch)
treeb4c5cefd82b9b4a8adb74cc3fee005e56911dbb7 /src/term.c
parent3efbce959e15a1fcfee5181653902bedc0724bce (diff)
(encode_terminal_code): Fix previous change.
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/term.c b/src/term.c
index 17607cea5d5..a4ddf976455 100644
--- a/src/term.c
+++ b/src/term.c
@@ -815,6 +815,7 @@ encode_terminal_code (src, dst, src_len, dst_len, consumed)
int len;
register int tlen = GLYPH_TABLE_LENGTH;
register Lisp_Object *tbase = GLYPH_TABLE_BASE;
+ int result;
struct coding_system *coding;
coding = (CODING_REQUIRE_ENCODING (&terminal_coding)
@@ -857,19 +858,24 @@ encode_terminal_code (src, dst, src_len, dst_len, consumed)
buf = GLYPH_STRING (tbase, g);
}
- encode_coding (coding, buf, dst, len, dst_end - dst);
+ result = encode_coding (coding, buf, dst, len, dst_end - dst);
len -= coding->consumed;
dst += coding->produced;
+ if (result == CODING_FINISH_INSUFFICIENT_DST
+ || (result == CODING_FINISH_INSUFFICIENT_SRC
+ && 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 starts from the same glyph. */
+ break;
+
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++;
+ /* This is the case that a code of the range 0200..0237
+ exists in buf. We must just write out such a code. */
+ buf += coding->consumed;
+ while (len--)
+ *dst++ = *buf++;
}
}
src++;