diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2009-11-18 17:02:17 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2009-11-18 17:02:17 +0000 |
commit | a78cc98c8bd79cecbb8574a9dff4c9867a8308d9 (patch) | |
tree | 479fa44868219f4e3c39720a6c0068f947ac36d5 /tty.c | |
parent | 8db145da1ed40d471e9ecff0e788ced26a43fc92 (diff) | |
download | rtmux-a78cc98c8bd79cecbb8574a9dff4c9867a8308d9.tar.gz rtmux-a78cc98c8bd79cecbb8574a9dff4c9867a8308d9.tar.bz2 rtmux-a78cc98c8bd79cecbb8574a9dff4c9867a8308d9.zip |
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.c | 14 |
1 files changed, 5 insertions, 9 deletions
@@ -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; } |