summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Mendoza-Jonas <sam.mj@au1.ibm.com>2014-09-10 10:50:44 +1000
committerJeremy Kerr <jk@ozlabs.org>2014-09-10 08:55:42 +0800
commit742b01687510dd78b3f5e6d3b98b5f420eb70443 (patch)
tree145ce053a51ba25ae468e8853e632fc6ba7a7f9f
parente62af29111fe6a3085b0f659915fbee202d0a235 (diff)
downloadtalos-petitboot-742b01687510dd78b3f5e6d3b98b5f420eb70443.tar.gz
talos-petitboot-742b01687510dd78b3f5e6d3b98b5f420eb70443.zip
ui/ncurses: Correctly size pad for config screen
Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
-rw-r--r--ui/ncurses/nc-config.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/ui/ncurses/nc-config.c b/ui/ncurses/nc-config.c
index 7a709ab..4b1a58f 100644
--- a/ui/ncurses/nc-config.c
+++ b/ui/ncurses/nc-config.c
@@ -781,13 +781,18 @@ static void config_screen_draw(struct config_screen *screen,
/* The size of the pad we'll need depends on the number of interfaces.
*
* We use N_FIELDS (which is quite conservative, as some fields share
- * a line) as a base, then add 3 (as the network select field is
- * takes 3 lines), and n_interfaces (as the network interface field
- * has n_interfaces lines).
+ * a line) as a base, then:
+ * - add 6 (as the network select & boot device select fields take 3
+ * lines each),
+ * - add n_interfaces for every field in the network select field, and
+ * - add (n_blockdevs + n_interfaces) for every field in the boot device
+ * select field
*/
- height = N_FIELDS + 3;
- if (sysinfo)
+ height = N_FIELDS + 6;
+ if (sysinfo) {
height += sysinfo->n_interfaces;
+ height += (sysinfo->n_blockdevs + sysinfo->n_interfaces);
+ }
if (!screen->pad || getmaxy(screen->pad) < height) {
if (screen->pad)
delwin(screen->pad);
OpenPOWER on IntegriCloud