aboutsummaryrefslogtreecommitdiff
path: root/tty.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2018-10-18 09:24:15 +0100
committerNicholas Marriott <nicholas.marriott@gmail.com>2018-10-18 09:24:15 +0100
commit2dfdb55ace6b0beab4903db630603fef5aa44c57 (patch)
tree3daf307b7e655b3205caa210d305116b5ee95743 /tty.c
parentf54f171d5c43a22414caeecbe8a71db44f345b4e (diff)
downloadrtmux-2dfdb55ace6b0beab4903db630603fef5aa44c57.tar.gz
rtmux-2dfdb55ace6b0beab4903db630603fef5aa44c57.tar.bz2
rtmux-2dfdb55ace6b0beab4903db630603fef5aa44c57.zip
Handle pan correctly when the terminal is bigger than the window.
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 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);