summaryrefslogtreecommitdiffstats
path: root/tty.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-11-18 17:02:17 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-11-18 17:02:17 +0000
commita78cc98c8bd79cecbb8574a9dff4c9867a8308d9 (patch)
tree479fa44868219f4e3c39720a6c0068f947ac36d5 /tty.c
parent8db145da1ed40d471e9ecff0e788ced26a43fc92 (diff)
Cleanup by moving various (mostly horrible) little bits handling UTF-8 grid
data into functions in a new file, grid-utf8.c, and use sizeof intead of UTF8_DATA. Also nuke trailing whitespace from tmux.1, reminded by jmc.
Diffstat (limited to 'tty.c')
-rw-r--r--tty.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/tty.c b/tty.c
index 8855a657..a3aeda5d 100644
--- a/tty.c
+++ b/tty.c
@@ -365,16 +365,12 @@ tty_putc(struct tty *tty, u_char ch)
void
tty_pututf8(struct tty *tty, const struct grid_utf8 *gu)
{
- u_int i;
-
- for (i = 0; i < UTF8_SIZE; i++) {
- if (gu->data[i] == 0xff)
- break;
- bufferevent_write(tty->event, &gu->data[i], 1);
- if (tty->log_fd != -1)
- write(tty->log_fd, &gu->data[i], 1);
- }
+ size_t size;
+ size = grid_utf8_size(gu);
+ bufferevent_write(tty->event, gu->data, size);
+ if (tty->log_fd != -1)
+ write(tty->log_fd, gu->data, size);
tty->cx += gu->width;
}