From dd25a6cdc21c76888c370a053ca2adb710a89cdf Mon Sep 17 00:00:00 2001
From: nicm <nicm>
Date: Wed, 15 Feb 2017 11:22:13 +0000
Subject: [PATCH] Do not clear to end of screen unless the pane is at the
 bottom.

---
 tty.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tty.c b/tty.c
index 53f57713..7bf13c46 100644
--- a/tty.c
+++ b/tty.c
@@ -1031,6 +1031,7 @@ tty_cmd_clearendofscreen(struct tty *tty, const struct tty_ctx *ctx)
 	tty_margin_off(tty);
 
 	if (tty_pane_full_width(tty, ctx) &&
+	    ctx->yoff + wp->sy >= tty->sy - 1 &&
 	    status_at_line(tty->client) <= 0 &&
 	    tty_term_has(tty->term, TTYC_ED)) {
 		tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);