=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/tty.c,v retrieving revision 1.352 retrieving revision 1.353 diff -u -r1.352 -r1.353 --- src/usr.bin/tmux/tty.c 2020/04/17 09:06:10 1.352 +++ src/usr.bin/tmux/tty.c 2020/04/17 21:33:18 1.353 @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.352 2020/04/17 09:06:10 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.353 2020/04/17 21:33:18 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1739,7 +1739,10 @@ 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 @@ * 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;