guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/01: installer: Fix unselection of buttons.


From: Danny Milosavljevic
Subject: 01/01: installer: Fix unselection of buttons.
Date: Thu, 20 Jul 2017 03:04:53 -0400 (EDT)

dannym pushed a commit to branch wip-installer-2
in repository guix.

commit ffb57d0c1c796a2299b250c90bc8db7eb793e533
Author: Danny Milosavljevic <address@hidden>
Date:   Thu Jul 20 09:04:17 2017 +0200

    installer: Fix unselection of buttons.
    
    * gurses/buttons.scm (buttons-select): Fix unselection of buttons.
---
 gurses/buttons.scm | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/gurses/buttons.scm b/gurses/buttons.scm
index a9ba2df..15cbdc2 100644
--- a/gurses/buttons.scm
+++ b/gurses/buttons.scm
@@ -88,18 +88,24 @@
                       (if (eq? ch c) sym #f)))))))
 
 (define (buttons-select buttons which)
+  " Select the button WHICH, or no button if WHICH = -1. """
   (let ((arry (buttons-array buttons))
        (current (buttons-selected buttons)))
-    (if (array-in-bounds? arry which)
-       (let ((new (cadr (array-ref arry which)))
-             (old (if (array-in-bounds? arry current)
-                      (cadr (array-ref arry current)) #f)))
-         (if (not (eqv? old new))
-             (begin
-             (draw-button new 'focused-button)
-             (if old
-                 (draw-button old 'button))))
-         (buttons-set-selected! buttons which)))))
+    (cond
+      ((= which -1)
+       (buttons-unselect-all buttons))
+      ((array-in-bounds? arry which)
+       (let ((new (cadr (array-ref arry which)))
+             (old (if (array-in-bounds? arry current)
+                      (cadr (array-ref arry current))
+                      #f)))
+         (if (not (eqv? old new))
+             (begin
+               (draw-button new 'focused-button)
+               (if old
+                 (draw-button old 'button))))
+         (buttons-set-selected! buttons which)))
+      (else #f))))
 
 (define (buttons-select-prev buttons)
   (let ((current (buttons-selected buttons)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]