From 4346098e977d8fb3bde0783e9858f3def7bc01a5 Mon Sep 17 00:00:00 2001 From: nicm Date: Sat, 28 Mar 2020 09:39:44 +0000 Subject: Fix how popup height is calculated to take embedded newlines into account. --- cmd-display-menu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'cmd-display-menu.c') diff --git a/cmd-display-menu.c b/cmd-display-menu.c index aafe2447..e12a24ab 100644 --- a/cmd-display-menu.c +++ b/cmd-display-menu.c @@ -237,7 +237,7 @@ cmd_display_popup_exec(struct cmd *self, struct cmdq_item *item) } if (nlines != 0) - h = nlines + 2; + h = popup_height(nlines, lines) + 2; else h = c->tty.sy / 2; if (args_has(args, 'h')) { @@ -262,6 +262,10 @@ cmd_display_popup_exec(struct cmd *self, struct cmdq_item *item) } } + if (w > c->tty.sx - 1) + w = c->tty.sx - 1; + if (h > c->tty.sy - 1) + h = c->tty.sy - 1; cmd_display_menu_get_position(c, item, args, &px, &py, w, h); value = args_get(args, 'd'); -- cgit