From 299a8fd4a3ced13ed678f888aa1b61484a2b613d Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sun, 15 Jan 2012 19:39:42 +0000 Subject: [PATCH] Calculate last position correctly for UTF-8 wide characters, reported by Matthias Lederhofer. --- tty.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tty.c b/tty.c index dce4887b..d5fc106e 100644 --- a/tty.c +++ b/tty.c @@ -969,7 +969,10 @@ tty_cmd_cell(struct tty *tty, const struct tty_ctx *ctx) * move as far left as possible and redraw the last * cell to move into the last position. */ - cx = screen_size_x(s) - width; + if (ctx->last_cell.flags & GRID_FLAG_UTF8) + cx = screen_size_x(s) - ctx->last_utf8.width; + else + cx = screen_size_x(s) - 1; tty_cursor_pane(tty, ctx, cx, ctx->ocy); tty_cell(tty, &ctx->last_cell, &ctx->last_utf8); }