aboutsummaryrefslogtreecommitdiff
path: root/tty.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-10-23 17:16:25 +0000
committerTiago Cunha <tcunha@gmx.com>2009-10-23 17:16:25 +0000
commitf41a3914a55cd61223418a019cb23e6aee173098 (patch)
tree6be4c3c02ff9f53a4b84ec354b2cb084d38f827b /tty.c
parentc643ac48278b793d17d0e8edd140af6d9d68128a (diff)
downloadrtmux-f41a3914a55cd61223418a019cb23e6aee173098.tar.gz
rtmux-f41a3914a55cd61223418a019cb23e6aee173098.tar.bz2
rtmux-f41a3914a55cd61223418a019cb23e6aee173098.zip
Sync OpenBSD patchset 421:
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.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/tty.c b/tty.c
index 8d04f348..a6dac18d 100644
--- a/tty.c
+++ b/tty.c
@@ -1,4 +1,4 @@
-/* $Id: tty.c,v 1.157 2009-10-23 17:13:10 tcunha Exp $ */
+/* $Id: tty.c,v 1.158 2009-10-23 17:16:24 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -347,7 +347,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)
@@ -357,8 +357,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