aboutsummaryrefslogtreecommitdiff
path: root/tty.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-11-19 22:23:27 +0000
committerTiago Cunha <tcunha@gmx.com>2009-11-19 22:23:27 +0000
commita0b2b8e875f5118203125e048f1d89029462f98d (patch)
tree9d4e18cf622e6f641443c326725f30ff65617f52 /tty.c
parentacc331c787f4d85c0909563139f7cc81c54edc55 (diff)
downloadrtmux-a0b2b8e875f5118203125e048f1d89029462f98d.tar.gz
rtmux-a0b2b8e875f5118203125e048f1d89029462f98d.tar.bz2
rtmux-a0b2b8e875f5118203125e048f1d89029462f98d.zip
Sync OpenBSD patchset 547:
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.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/tty.c b/tty.c
index a5e1770b..b163552e 100644
--- a/tty.c
+++ b/tty.c
@@ -1,4 +1,4 @@
-/* $Id: tty.c,v 1.174 2009-11-13 16:57:21 tcunha Exp $ */
+/* $Id: tty.c,v 1.175 2009-11-19 22:23:27 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -370,16 +370,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;
}