aboutsummaryrefslogtreecommitdiff
path: root/tty.c
diff options
context:
space:
mode:
authornicm <nicm>2017-03-15 15:22:14 +0000
committernicm <nicm>2017-03-15 15:22:14 +0000
commit2a9d69777164291349ef4a00888153a69c330151 (patch)
tree8617b228cf96f24241787a85e833ddf0ff5bff33 /tty.c
parent3c3c08b6d9704b00a12e14772b95f7a40c20b10e (diff)
downloadrtmux-2a9d69777164291349ef4a00888153a69c330151.tar.gz
rtmux-2a9d69777164291349ef4a00888153a69c330151.tar.bz2
rtmux-2a9d69777164291349ef4a00888153a69c330151.zip
Invalidate the cursor when we think we should have wrapped.
Diffstat (limited to 'tty.c')
-rw-r--r--tty.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tty.c b/tty.c
index 47b28454..03e4686b 100644
--- a/tty.c
+++ b/tty.c
@@ -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);