Skip to content

Commit

Permalink
Limit width and height to tty correctly, GitHub issue 2843.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicm committed Aug 23, 2021
1 parent 50e21e7 commit 2ce1483
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions usr.bin/tmux/cmd-display-menu.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $OpenBSD: cmd-display-menu.c,v 1.30 2021/08/22 13:48:29 nicm Exp $ */
/* $OpenBSD: cmd-display-menu.c,v 1.31 2021/08/23 08:17:41 nicm Exp $ */

/*
* Copyright (c) 2019 Nicholas Marriott <[email protected]>
Expand Down Expand Up @@ -218,7 +218,7 @@ cmd_display_menu_get_position(struct client *tc, struct cmdq_item *item,
else if (n < 0)
n = 0;
*px = n;
log_debug("%s: -x: %s = %s = %u", __func__, xp, p, *px);
log_debug("%s: -x: %s = %s = %u (-w %u)", __func__, xp, p, *px, w);
free(p);

/* Expand vertical position */
Expand All @@ -244,7 +244,7 @@ cmd_display_menu_get_position(struct client *tc, struct cmdq_item *item,
else if (n < 0)
n = 0;
*py = n;
log_debug("%s: -y: %s = %s = %u", __func__, yp, p, *py);
log_debug("%s: -y: %s = %s = %u (-h %u)", __func__, yp, p, *py, h);
free(p);

return (1);
Expand Down Expand Up @@ -359,10 +359,10 @@ cmd_display_popup_exec(struct cmd *self, struct cmdq_item *item)
}
}

if (w > tty->sx - 1)
w = tty->sx - 1;
if (h > tty->sy - 1)
h = tty->sy - 1;
if (w > tty->sx)
w = tty->sx;
if (h > tty->sy)
h = tty->sy;
if (!cmd_display_menu_get_position(tc, item, args, &px, &py, w, h))
return (CMD_RETURN_NORMAL);

Expand Down

0 comments on commit 2ce1483

Please sign in to comment.