From 2dfdb55ace6b0beab4903db630603fef5aa44c57 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 18 Oct 2018 09:24:15 +0100 Subject: [PATCH] Handle pan correctly when the terminal is bigger than the window. --- tty.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tty.c b/tty.c index cee5acbc..7cc129e5 100644 --- a/tty.c +++ b/tty.c @@ -746,10 +746,14 @@ tty_window_offset1(struct tty *tty, u_int *ox, u_int *oy, u_int *sx, u_int *sy) *sy = tty->sy - lines; if (c->pan_window == w) { - if (c->pan_ox + *sx > w->sx) + if (*sx >= w->sx) + c->pan_ox = 0; + else if (c->pan_ox + *sx > w->sx) c->pan_ox = w->sx - *sx; *ox = c->pan_ox; - if (c->pan_oy + *sy > w->sy) + if (*sy >= w->sy) + c->pan_oy = 0; + else if (c->pan_oy + *sy > w->sy) c->pan_oy = w->sy - *sy; *oy = c->pan_oy; return (1);