aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2012-01-20 21:16:07 +0000
committerTiago Cunha <tcunha@gmx.com>2012-01-20 21:16:07 +0000
commitad5c4e719bb14f4c686c0482433f64729648ca02 (patch)
treeaa957d580057faf9841a99ff708dd94bf7bb3cc3
parentdb7570daabb2ffb138f96938bcc85b163596b405 (diff)
downloadrtmux-ad5c4e719bb14f4c686c0482433f64729648ca02.tar.gz
rtmux-ad5c4e719bb14f4c686c0482433f64729648ca02.tar.bz2
rtmux-ad5c4e719bb14f4c686c0482433f64729648ca02.zip
Sync OpenBSD patchset 997:
Calculate last position correctly for UTF-8 wide characters, reported by Matthias Lederhofer.
-rw-r--r--tty.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tty.c b/tty.c
index 64a33271..a4e7d7b1 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);
}