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.
This commit is contained in:
Nicholas Marriott
2009-11-18 17:02:17 +00:00
parent 8db145da1e
commit a78cc98c8b
8 changed files with 157 additions and 70 deletions

14
tty.c
View File

@ -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;
}