aboutsummaryrefslogtreecommitdiff
path: root/tty.c
diff options
context:
space:
mode:
authornicm <nicm>2020-04-17 21:33:18 +0000
committernicm <nicm>2020-04-17 21:33:18 +0000
commita877a5d8c96f317cb8c496f0c9afa0304be926a6 (patch)
treeaf0b9651e23f47baa1c6dcd415d63607f86e7d72 /tty.c
parentbbd6e899a8618229f27f04e81a95163968a7b905 (diff)
downloadrtmux-a877a5d8c96f317cb8c496f0c9afa0304be926a6.tar.gz
rtmux-a877a5d8c96f317cb8c496f0c9afa0304be926a6.tar.bz2
rtmux-a877a5d8c96f317cb8c496f0c9afa0304be926a6.zip
Do not move the cursor to the existing y position if it is invalid, go
home instead.
Diffstat (limited to 'tty.c')
-rw-r--r--tty.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/tty.c b/tty.c
index 4090a115..9c03c08a 100644
--- a/tty.c
+++ b/tty.c
@@ -1739,7 +1739,10 @@ tty_cmd_scrollup(struct tty *tty, const struct tty_ctx *ctx)
for (i = 0; i < ctx->num; i++)
tty_putc(tty, '\n');
} else {
- tty_cursor(tty, 0, tty->cy);
+ if (tty->cy == UINT_MAX)
+ tty_cursor(tty, 0, 0);
+ else
+ tty_cursor(tty, 0, tty->cy);
tty_putcode1(tty, TTYC_INDN, ctx->num);
}
}
@@ -2063,8 +2066,12 @@ tty_region(struct tty *tty, u_int rupper, u_int rlower)
* flag so further output causes a line feed). As a workaround, do an
* explicit move to 0 first.
*/
- if (tty->cx >= tty->sx)
- tty_cursor(tty, 0, tty->cy);
+ if (tty->cx >= tty->sx) {
+ if (tty->cy == UINT_MAX)
+ tty_cursor(tty, 0, 0);
+ else
+ tty_cursor(tty, 0, tty->cy);
+ }
tty_putcode2(tty, TTYC_CSR, tty->rupper, tty->rlower);
tty->cx = tty->cy = UINT_MAX;