summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-10-21 16:52:31 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-10-21 16:52:31 +0000
commit0afb47da859d80716a113ea434f028fb5480a737 (patch)
treebf4f0ce08190c4fb79e8af9b9c1e7fbfb45c4368 /usr.bin
parent18ac0e92cede2c327acb9868ef6d2cf5c1a3c382 (diff)
Now we are correctly not redrawing the whole pane on linefeed, redo the
last-cursor-position code to move to the right position when panes reach EOL.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/tty.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c
index 0bf002583d3..282b3eea38c 100644
--- a/usr.bin/tmux/tty.c
+++ b/usr.bin/tmux/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.56 2009/10/21 13:42:44 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.57 2009/10/21 16:52:30 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -851,17 +851,24 @@ tty_cmd_cell(struct tty *tty, const struct tty_ctx *ctx)
{
struct window_pane *wp = ctx->wp;
struct screen *s = wp->screen;
- u_int cx;
+ u_int cx, sx;
tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
- /*
- * Should the cursor be in the last cursor position ready for a natural
- * wrap? If so - and it isn't - move to and rewrite the last cell.
- */
- if (!(tty->term->flags & TERM_EARLYWRAP) &&
- ctx->ocx + wp->xoff > tty->sx - ctx->last_width) {
- if (tty->cx < tty->sx) {
+ /* Is the cursor in the very last position? */
+ if (ctx->ocx > wp->sx - ctx->last_width) {
+ if (wp->xoff != 0 || wp->sx != tty->sx) {
+ /*
+ * The pane doesn't fill the entire line, the linefeed
+ * will already have happened, so just move the cursor.
+ */
+ tty_cursor_pane(tty, ctx, 0, ctx->ocy + 1);
+ } else if (tty->cx < tty->sx) {
+ /*
+ * The cursor isn't in the last position already, so
+ * move as far left as possinble and redraw the last
+ * cell to move into the last position.
+ */
cx = screen_size_x(s) - ctx->last_width;
tty_cursor_pane(tty, ctx, cx, ctx->ocy);
tty_cell(tty, &ctx->last_cell, &ctx->last_utf8);