[1/4] ui/ncurses: Extend nc-subset pad height
diff mbox

Message ID 20170615045431.29572-2-sam@mendozajonas.com
State Accepted
Headers show

Commit Message

Samuel Mendoza-Jonas June 15, 2017, 4:54 a.m. UTC
The nc-subset screen can exceed its maximum height if some options are
long enough to wrap around to two lines. Increaes the maximum size of
the pad to account for every line potentially wrapping once.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
---
 ui/ncurses/nc-subset.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Patch
diff mbox

diff --git a/ui/ncurses/nc-subset.c b/ui/ncurses/nc-subset.c
index 8336725..50e1b65 100644
--- a/ui/ncurses/nc-subset.c
+++ b/ui/ncurses/nc-subset.c
@@ -222,8 +222,11 @@  static void subset_screen_draw(struct subset_screen *screen)
 	bool repost = false;
 	int height;
 
-	/* Size of pad = top space + number of available options */
-	height = 1 + N_FIELDS + widget_subset_n_inactive(screen->options);
+	/*
+	 * Size of pad = top space + 2 * number of available options in case
+	 * device names wrap
+	 */
+	height = 1 + N_FIELDS + widget_subset_n_inactive(screen->options) * 2;
 
 	if (!screen->pad || getmaxy(screen->pad) < height) {
 		if (screen->pad)