From 0e13414b5bbbb96cc6b8d83d2974cfea8ff8d073 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Fri, 6 Nov 2020 10:59:54 +0100 Subject: [PATCH] installer: Limit listbox height. Partially fixes: . * gnu/installer/newt/page.scm (default-listbox-height): New variable. (run-listbox-selection-page): Use it. * gnu/installer/newt/wifi.scm (wifi-listbox-height): Ditto. * gnu/installer/newt/network.scm (run-technology-page): Set the maximum listbox height to 5. * gnu/installer/newt/ethernet.scm (run-ethernet-page): Ditto. --- gnu/installer/newt/ethernet.scm | 2 +- gnu/installer/newt/network.scm | 2 +- gnu/installer/newt/page.scm | 11 +++++++++-- gnu/installer/newt/wifi.scm | 3 ++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/gnu/installer/newt/ethernet.scm b/gnu/installer/newt/ethernet.scm index ba5e222a37..ecd22efbb2 100644 --- a/gnu/installer/newt/ethernet.scm +++ b/gnu/installer/newt/ethernet.scm @@ -77,7 +77,7 @@ connection is pending." #:title (G_ "Ethernet connection") #:listbox-items services #:listbox-item->text ethernet-service->text - #:listbox-height (min (+ (length services) 2) 10) + #:listbox-height (min (+ (length services) 2) 5) #:button-text (G_ "Exit") #:button-callback-procedure (lambda _ diff --git a/gnu/installer/newt/network.scm b/gnu/installer/newt/network.scm index 461d5d99c0..4af7143d63 100644 --- a/gnu/installer/newt/network.scm +++ b/gnu/installer/newt/network.scm @@ -80,7 +80,7 @@ network devices were found. Do you want to continue anyway?")) #:title (G_ "Internet access") #:listbox-items items #:listbox-item->text technology->text - #:listbox-height (min (+ (length items) 2) 10) + #:listbox-height (min (+ (length items) 2) 5) #:button-text (G_ "Exit") #:button-callback-procedure (lambda _ diff --git a/gnu/installer/newt/page.scm b/gnu/installer/newt/page.scm index 1d6b9979b4..4209674c28 100644 --- a/gnu/installer/newt/page.scm +++ b/gnu/installer/newt/page.scm @@ -32,7 +32,9 @@ #:use-module (srfi srfi-34) #:use-module (srfi srfi-35) #:use-module (newt) - #:export (draw-info-page + #:export (default-listbox-height + + draw-info-page draw-connecting-page run-input-page run-error-page @@ -168,6 +170,10 @@ Like 'run-form', return two values: the exit reason, and an \"argument\"." (_ (values reason argument)))))) +(define (default-listbox-height) + "Return the default listbox height." + (max 5 (- (screen-rows) 20))) + (define (draw-info-page text title) "Draw an informative page with the given TEXT as content. Set the title of this page to TITLE." @@ -339,7 +345,8 @@ of the page is set to TITLE." (info-textbox-width 50) listbox-items listbox-item->text - (listbox-height 20) + (listbox-height + (default-listbox-height)) (listbox-default-item #f) (listbox-allow-multiple? #f) (sort-listbox-items? #t) diff --git a/gnu/installer/newt/wifi.scm b/gnu/installer/newt/wifi.scm index 3fd5756b99..f5d8f1fdbf 100644 --- a/gnu/installer/newt/wifi.scm +++ b/gnu/installer/newt/wifi.scm @@ -165,7 +165,8 @@ of records present in LISTBOX." (define service-name-max-length (make-parameter 20)) ;; Height of the listbox displaying wifi services. -(define wifi-listbox-height (make-parameter 20)) +(define wifi-listbox-height (make-parameter + (default-listbox-height))) ;; Information textbox width. (define info-textbox-width (make-parameter 40)) -- 2.29.2