summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2017-03-15 15:22:15 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2017-03-15 15:22:15 +0000
commit184b9a6a5df059dbdec756be271cf2fa778ddf1d (patch)
tree2091db758a70fe7b800dac3678507a3f09fd6b89 /usr.bin
parent5f408e08fd8bf86f6e77fa07e833048027c01cf4 (diff)
Invalidate the cursor when we think we should have wrapped.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/tty.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c
index 9a4d9d1b47d..eea73ba36c3 100644
--- a/usr.bin/tmux/tty.c
+++ b/usr.bin/tmux/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.253 2017/03/15 09:21:21 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.254 2017/03/15 15:22:14 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -476,7 +476,10 @@ void
tty_putn(struct tty *tty, const void *buf, size_t len, u_int width)
{
tty_add(tty, buf, len);
- tty->cx += width;
+ if (tty->cx + width > tty->sx)
+ tty->cx = tty->cy = UINT_MAX;
+ else
+ tty->cx += width;
}
static void
@@ -1403,7 +1406,8 @@ tty_cursor_pane_unless_wrap(struct tty *tty, const struct tty_ctx *ctx,
(tty->term->flags & TERM_EARLYWRAP) ||
ctx->xoff + cx != 0 ||
ctx->yoff + cy != tty->cy + 1 ||
- tty->cx < tty->sx)
+ tty->cx < tty->sx ||
+ tty->cy == tty->rlower)
tty_cursor_pane(tty, ctx, cx, cy);
else
log_debug("%s: will wrap at %u,%u", __func__, tty->cx, tty->cy);