aboutsummaryrefslogtreecommitdiff
path: root/tty.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-10-20 17:33:33 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-10-20 17:33:33 +0000
commit62f234ce3b3fb10633f8bbb1d4159cd5c179345a (patch)
treeac8494b4eadbe71c3b7f7aabd30a725035676f20 /tty.c
parent387f4d42ccfb9aab1b8d5f10176dac2a3209c3fa (diff)
downloadrtmux-62f234ce3b3fb10633f8bbb1d4159cd5c179345a.tar.gz
rtmux-62f234ce3b3fb10633f8bbb1d4159cd5c179345a.tar.bz2
rtmux-62f234ce3b3fb10633f8bbb1d4159cd5c179345a.zip
UTF-8 combined character fixes.
Thai can have treble combinations (1 x width=1 then 2 x width=0) so bump the UTF-8 cell data size to 9 and alter the code to allow this. Also break off the combining code into a separate function, handle any further combining beyond the buffer size by replacing the character with _s, and when redrawing the UTF-8 character don't assume the first part has just been printed, redraw the entire line.
Diffstat (limited to 'tty.c')
-rw-r--r--tty.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/tty.c b/tty.c
index 93d61c0e..9ddffb95 100644
--- a/tty.c
+++ b/tty.c
@@ -874,14 +874,13 @@ tty_cmd_cell(struct tty *tty, const struct tty_ctx *ctx)
void
tty_cmd_utf8character(struct tty *tty, const struct tty_ctx *ctx)
{
- u_char *ptr = ctx->ptr;
- size_t i;
+ struct window_pane *wp = ctx->wp;
- for (i = 0; i < UTF8_SIZE; i++) {
- if (ptr[i] == 0xff)
- break;
- tty_putc(tty, ptr[i]);
- }
+ /*
+ * Cannot rely on not being a partial character, so just redraw the
+ * whole line.
+ */
+ tty_draw_line(tty, wp->screen, ctx->ocy, wp->xoff, wp->yoff);
}
void