summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2012-01-15 19:39:42 +0000
committernicm <nicm@openbsd.org>2012-01-15 19:39:42 +0000
commit4754363f53e052f67d7a79ac6a555ce88a9d2b0f (patch)
tree0ab39007d3878e7a134a1fd0081be79ddcbd097e
parentAdd ascii_{load,dump}_time() to properly deal with time_t. (diff)
downloadwireguard-openbsd-4754363f53e052f67d7a79ac6a555ce88a9d2b0f.tar.xz
wireguard-openbsd-4754363f53e052f67d7a79ac6a555ce88a9d2b0f.zip
Calculate last position correctly for UTF-8 wide characters, reported by
Matthias Lederhofer.
-rw-r--r--usr.bin/tmux/tty.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c
index b38996f01ca..6f44eb21839 100644
--- a/usr.bin/tmux/tty.c
+++ b/usr.bin/tmux/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.110 2011/08/24 09:58:44 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.111 2012/01/15 19:39:42 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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);
}