aboutsummaryrefslogtreecommitdiff
path: root/tty.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-10-20 19:18:28 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-10-20 19:18:28 +0000
commit1af09d6330ddba2d3ffc9c15d056fe8c4321f17e (patch)
tree0ad97a43760cbde70e21af1d9e8b74ad3a3b0d03 /tty.c
parent62f234ce3b3fb10633f8bbb1d4159cd5c179345a (diff)
downloadrtmux-1af09d6330ddba2d3ffc9c15d056fe8c4321f17e.tar.gz
rtmux-1af09d6330ddba2d3ffc9c15d056fe8c4321f17e.tar.bz2
rtmux-1af09d6330ddba2d3ffc9c15d056fe8c4321f17e.zip
Try to reduce the UTF-8 mess.
Get rid of passing around u_char[4]s and define a struct utf8_data which has character data, size (sequence length) and width. Move UTF-8 character collection into two functions utf8_open/utf8_append in utf8.c which fill in this struct and use these functions from input.c and the various functions in screen-write.c. Space for rather more data than is necessary for one UTF-8 sequence is in the utf8_data struct because screen_write_copy is still nasty and needs to reinject the character (after combining) into screen_write_cell.
Diffstat (limited to 'tty.c')
-rw-r--r--tty.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/tty.c b/tty.c
index 9ddffb95..ee725edf 100644
--- a/tty.c
+++ b/tty.c
@@ -342,7 +342,7 @@ tty_putc(struct tty *tty, u_char ch)
void
tty_pututf8(struct tty *tty, const struct grid_utf8 *gu)
{
- u_int i, width;
+ u_int i;
for (i = 0; i < UTF8_SIZE; i++) {
if (gu->data[i] == 0xff)
@@ -352,8 +352,7 @@ tty_pututf8(struct tty *tty, const struct grid_utf8 *gu)
write(tty->log_fd, &gu->data[i], 1);
}
- width = utf8_width(gu->data);
- tty->cx += width;
+ tty->cx += gu->width;
}
void