[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
20/20: installer: Enable direct scrolling to top or bottom of menus.
From: |
John Darrington |
Subject: |
20/20: installer: Enable direct scrolling to top or bottom of menus. |
Date: |
Thu, 12 Jan 2017 20:41:04 +0000 (UTC) |
jmd pushed a commit to branch wip-installer
in repository guix.
commit 3673cd86e1b3271095e6affa4f74565cd3d4013f
Author: John Darrington <address@hidden>
Date: Thu Jan 12 16:57:38 2017 +0100
installer: Enable direct scrolling to top or bottom of menus.
* gurses/menu.scm (menu-goto-start, menu-goto-end): New procedures.
(std-menu-key-handler): connect them to Home and End keys.
---
gurses/menu.scm | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/gurses/menu.scm b/gurses/menu.scm
index 8a8f74b..1fca9bc 100644
--- a/gurses/menu.scm
+++ b/gurses/menu.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2016 John Darrington <address@hidden>
+;;; Copyright © 2016, 2017 John Darrington <address@hidden>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -78,6 +78,19 @@
(menu-set-top-item! menu (max 0 (- (menu-top-item menu) step)))
(menu-redraw menu))
+(define (menu-goto-start menu)
+ (menu-set-top-item! menu 0)
+ (menu-set-current-item! menu 0)
+ (menu-redraw menu))
+
+(define (menu-goto-end menu)
+ (let ((n-items (length (menu-items menu)))
+ (window-height (getmaxy (menu-window menu))))
+ (menu-set-top-item! menu (max 0 (- n-items window-height)))
+ (menu-set-current-item! menu (1- n-items))
+ (menu-redraw menu)))
+
+
(define* (menu-down menu #:key (step 1))
"Move the selected item down by STEP items. Returns #f if on the last item."
(if (< (menu-current-item menu) (1- (length (menu-items menu))))
@@ -141,7 +154,13 @@
((eq? ch KEY_PPAGE)
(menu-active menu)
(menu-up menu #:step (getmaxy (menu-window menu))))
-
+
+ ((eq? ch KEY_HOME)
+ (menu-goto-start menu))
+
+ ((eq? ch KEY_END)
+ (menu-goto-end menu))
+
((or (eq? ch KEY_DOWN)
(eq? ch #\so))
(if (menu-active menu)
- 03/20: installer: Remove pointless calls to delwin., (continued)
- 03/20: installer: Remove pointless calls to delwin., John Darrington, 2017/01/12
- 14/20: installer: Use "lspci -mm" instead of "lspci -m"., John Darrington, 2017/01/12
- 17/20: installer: Use a cleaner method of detecting wireless capability for ethernet interfaces., John Darrington, 2017/01/12
- 09/20: installer: Make all windows with ports scrollable., John Darrington, 2017/01/12
- 08/20: installer: Ignore case in button accelerators., John Darrington, 2017/01/12
- 05/20: installer: New procedure: page-enter., John Darrington, 2017/01/12
- 11/20: installer: Add installer source files to the manifest of translatables., John Darrington, 2017/01/12
- 15/20: installer: slurp: Ignore blank lines in output., John Darrington, 2017/01/12
- 04/20: installer: New procedure "page-leave"., John Darrington, 2017/01/12
- 18/20: guix: Add IFF_RUNNING to exported syscall constants., John Darrington, 2017/01/12
- 20/20: installer: Enable direct scrolling to top or bottom of menus.,
John Darrington <=
- 19/20: installer: Make the network menu more reliable., John Darrington, 2017/01/12
- 07/20: installer: Rename "Back" buttons to "Cancel"., John Darrington, 2017/01/12
- 13/20: installer: Use guix build syscalls module for network interrogation., John Darrington, 2017/01/12
- 10/20: installer: Rename 'file-browser.scm' to 'key-map.scm'., John Darrington, 2017/01/12
- 06/20: installer: Ensure that the cursor visibility is updated on each page., John Darrington, 2017/01/12
- 16/20: installer: Minor cleanup., John Darrington, 2017/01/12