Commit 9332ea03 authored by Kenichi Handa's avatar Kenichi Handa
Browse files

Include "buffer.h" and "character.h".

(encode_terminal_code): Adjusted for the new code-conversion API.
(write_glyphs): Likewise.
(produce_glyphs): Call CHAR_WIDTH instead of CHARSET_WIDTH.
parent f4926ee8
...@@ -29,6 +29,8 @@ Boston, MA 02111-1307, USA. */ ...@@ -29,6 +29,8 @@ Boston, MA 02111-1307, USA. */
#include "termchar.h" #include "termchar.h"
#include "termopts.h" #include "termopts.h"
#include "lisp.h" #include "lisp.h"
#include "buffer.h"
#include "character.h"
#include "charset.h" #include "charset.h"
#include "coding.h" #include "coding.h"
#include "keyboard.h" #include "keyboard.h"
...@@ -872,12 +874,13 @@ encode_terminal_code (src, dst, src_len, dst_len, consumed) ...@@ -872,12 +874,13 @@ encode_terminal_code (src, dst, src_len, dst_len, consumed)
} }
} }
result = encode_coding (coding, buf, dst, len, dst_end - dst); coding->source = buf;
coding->destination = dst;
coding->dst_bytes = dst_end - dst;
encode_coding_object (coding, Qnil, 0, 0, 1, len, Qnil);
len -= coding->consumed; len -= coding->consumed;
dst += coding->produced; dst += coding->produced;
if (result == CODING_FINISH_INSUFFICIENT_DST if (coding->result == CODING_RESULT_INSUFFICIENT_DST)
|| (result == CODING_FINISH_INSUFFICIENT_SRC
&& len > dst_end - dst))
/* The remaining output buffer is too short. We must /* The remaining output buffer is too short. We must
break the loop here without increasing SRC so that the break the loop here without increasing SRC so that the
next call of this function starts from the same glyph. */ next call of this function starts from the same glyph. */
...@@ -981,8 +984,10 @@ write_glyphs (string, len) ...@@ -981,8 +984,10 @@ write_glyphs (string, len)
if (CODING_REQUIRE_FLUSHING (&terminal_coding)) if (CODING_REQUIRE_FLUSHING (&terminal_coding))
{ {
terminal_coding.mode |= CODING_MODE_LAST_BLOCK; terminal_coding.mode |= CODING_MODE_LAST_BLOCK;
encode_coding (&terminal_coding, "", conversion_buffer, terminal_coding.source = (unsigned char *) "";
0, conversion_buffer_size); terminal_coding.destination = conversion_buffer;
terminal_coding.dst_bytes = conversion_buffer_size;
encode_coding_object (&terminal_coding, Qnil, 0, 0, 0, 0, Qnil);
if (terminal_coding.produced > 0) if (terminal_coding.produced > 0)
{ {
fwrite (conversion_buffer, 1, terminal_coding.produced, stdout); fwrite (conversion_buffer, 1, terminal_coding.produced, stdout);
...@@ -1713,13 +1718,7 @@ produce_glyphs (it) ...@@ -1713,13 +1718,7 @@ produce_glyphs (it)
} }
else else
{ {
/* A multi-byte character. The display width is fixed for all it->pixel_width = CHAR_WIDTH (it->c);
characters of the set. Some of the glyphs may have to be
ignored because they are already displayed in a continued
line. */
int charset = CHAR_CHARSET (it->c);
it->pixel_width = CHARSET_WIDTH (charset);
it->nglyphs = it->pixel_width; it->nglyphs = it->pixel_width;
if (it->glyph_row) if (it->glyph_row)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment