From ec267cf215152091f2c3d7dd4966f9c5da1b704a Mon Sep 17 00:00:00 2001 From: Peter Eckersley Date: Fri, 20 Nov 2015 14:58:37 -0800 Subject: [PATCH] "Compute" the minimum height needed to reasonably display input --- letsencrypt/display/util.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/letsencrypt/display/util.py b/letsencrypt/display/util.py index 0e9c76e38..7107bfb3b 100644 --- a/letsencrypt/display/util.py +++ b/letsencrypt/display/util.py @@ -114,7 +114,11 @@ class NcursesDisplay(object): `string` - input entered by the user """ - return self.dialog.inputbox(message, width=self.width) + sections = message.split("\n") + # each section takes at least one line, plus extras if it's longer than self.width + wordlines = [1+(len(section)/self.width) for section in sections] + height = 6+ sum(wordlines) + len(sections) + return self.dialog.inputbox(message, width=self.width, height=height) def yesno(self, message, yes_label="Yes", no_label="No"): """Display a Yes/No dialog box.