summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorMathieu Othacehe <othacehe@gnu.org>2020-11-06 10:59:54 +0100
committerMathieu Othacehe <othacehe@gnu.org>2020-11-08 10:51:23 +0100
commitae0fe289d3e5e0ae7d8c0764ddb4f58b275ee3b0 (patch)
tree68fa76d6a174331d8d5344299dad796575c8749d /gnu
parentafa77bd2287f303aefdd00193309ccf57f6dcd93 (diff)
downloadguix-ae0fe289d3e5e0ae7d8c0764ddb4f58b275ee3b0.tar.gz
installer: Limit listbox height.
Fixes: <https://issues.guix.gnu.org/44428>.

* gnu/installer/newt.scm (init): Print screen size.
* 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/final.scm (run-config-display-page): Change listbox
height.
* gnu/installer/newt/partition.scm (run-disk-page): Ditto.
* gnu/installer/newt/welcome.scm (display-logo?): New procedure.
(run-menu-page): Use it.
* gnu/installer/steps.scm (%configuration-file-width): Remove it.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/installer/newt.scm1
-rw-r--r--gnu/installer/newt/ethernet.scm2
-rw-r--r--gnu/installer/newt/final.scm5
-rw-r--r--gnu/installer/newt/network.scm2
-rw-r--r--gnu/installer/newt/page.scm11
-rw-r--r--gnu/installer/newt/partition.scm2
-rw-r--r--gnu/installer/newt/welcome.scm8
-rw-r--r--gnu/installer/newt/wifi.scm3
-rw-r--r--gnu/installer/steps.scm2
9 files changed, 24 insertions, 12 deletions
diff --git a/gnu/installer/newt.scm b/gnu/installer/newt.scm
index fdab721b2f..a1cbeca49a 100644
--- a/gnu/installer/newt.scm
+++ b/gnu/installer/newt.scm
@@ -46,6 +46,7 @@
   (newt-init)
   (clear-screen)
   (set-screen-size!)
+  (syslog "Display is ~ax~a.~%" (screen-columns) (screen-rows))
   (push-help-line
    (format #f (G_ "Press <F1> for installation parameters."))))
 
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/final.scm b/gnu/installer/newt/final.scm
index 5019a67429..7f6dd9f075 100644
--- a/gnu/installer/newt/final.scm
+++ b/gnu/installer/newt/final.scm
@@ -40,9 +40,8 @@
       file))
 
 (define* (run-config-display-page #:key locale)
-  (let ((width (%configuration-file-width))
-        (height (nearest-exact-integer
-                 (/ (screen-rows) 2))))
+  (let ((width (max 70 (- (screen-columns) 20)))
+        (height (default-listbox-height)))
     (run-file-textbox-page
      #:info-text (format #f (G_ "\
 We're now ready to proceed with the installation! \
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/partition.scm b/gnu/installer/newt/partition.scm
index 35f76db3ed..8561eb1ecf 100644
--- a/gnu/installer/newt/partition.scm
+++ b/gnu/installer/newt/partition.scm
@@ -681,7 +681,7 @@ by pressing the Exit button.~%~%")))
                       (G_ "Guided partitioning")
                       (G_ "Manual partitioning"))
           #:info-textbox-width 76         ;we need a lot of room for INFO-TEXT
-          #:listbox-height 12
+          #:listbox-height (max 5 (- (screen-rows) 30))
           #:listbox-items (disk-items)
           #:listbox-item->text cdr
           #:sort-listbox-items? #f
diff --git a/gnu/installer/newt/welcome.scm b/gnu/installer/newt/welcome.scm
index 1b4b2df816..5f461279e2 100644
--- a/gnu/installer/newt/welcome.scm
+++ b/gnu/installer/newt/welcome.scm
@@ -38,6 +38,9 @@
 (define info-textbox-width (make-parameter 70))
 (define options-listbox-height (make-parameter 5))
 
+(define (display-logo?)
+  (> (screen-rows) 35))
+
 (define* (run-menu-page title info-text logo
                         #:key
                         listbox-items
@@ -55,7 +58,10 @@ we want this page to occupy all the screen space available."
          items))
 
   (let* ((logo-textbox
-          (make-textbox -1 -1 (logo-width) (logo-height) 0))
+          (make-textbox -1 -1
+                        (if (display-logo?) (logo-width) 0)
+                        (if (display-logo?) (logo-height) 0)
+                        0))
          (info-textbox
           (make-reflowed-textbox -1 -1
                                  info-text
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 <service-item> 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))
diff --git a/gnu/installer/steps.scm b/gnu/installer/steps.scm
index 16d74c207f..fdcfb0cb4d 100644
--- a/gnu/installer/steps.scm
+++ b/gnu/installer/steps.scm
@@ -50,7 +50,6 @@
 
             %installer-configuration-file
             %installer-target-dir
-            %configuration-file-width
             format-configuration
             configuration->file))
 
@@ -218,7 +217,6 @@ stored in RESULTS. Return #f otherwise."
 
 (define %installer-configuration-file (make-parameter "/mnt/etc/config.scm"))
 (define %installer-target-dir (make-parameter "/mnt"))
-(define %configuration-file-width (make-parameter 79))
 
 (define (format-configuration steps results)
   "Return the list resulting from the application of the procedure defined in