[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
120/197: gurses: Mini refactor.
From: |
Danny Milosavljevic |
Subject: |
120/197: gurses: Mini refactor. |
Date: |
Mon, 3 Jul 2017 20:37:11 -0400 (EDT) |
dannym pushed a commit to branch wip-installer-2
in repository guix.
commit 61bd7e6e72d0a219c93c234b493ad57689298830
Author: John Darrington <address@hidden>
Date: Wed Jan 18 17:46:19 2017 +0100
gurses: Mini refactor.
* gurses/form.scm: (draw-field-space): New procedure.
---
gurses/form.scm | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/gurses/form.scm b/gurses/form.scm
index b2161b6..bfa7620 100644
--- a/gurses/form.scm
+++ b/gurses/form.scm
@@ -34,6 +34,7 @@
#:use-module (ncurses curses)
#:use-module (ice-9 match)
+ #:use-module (srfi srfi-1)
#:use-module (srfi srfi-9))
(define-record-type <field>
@@ -62,12 +63,21 @@
(+ (field-cursor-position field)
(form-tabpos form)))))
+(define (draw-field-space win field y x)
+ "Draws the template for FIELD at Y, X"
+ (addchstr win
+ (make-list
+ (if (list? (field-size field))
+ (fold (lambda (x prev) (max prev (string-length x))) 0
+ (field-size field))
+ (field-size field))
+ (underline #\space))
+ #:y y
+ #:x x))
+
(define (redraw-field form field n)
"Redraw the FIELD in FORM"
- (addchstr (form-window form)
- (make-list (field-size field) (underline #\space))
- #:y n
- #:x (form-tabpos form))
+ (draw-field-space (form-window form) field n (form-tabpos form))
(addstr (form-window form) (field-value field)
#:y n
@@ -241,7 +251,7 @@ label eq? to N"
(pos 0))
(if (array-in-bounds? fields pos)
(let ((f (array-ref fields pos)))
- (addchstr win (make-list (field-size f) (underline #\space)) #:y
pos #:x xpos)
+ (draw-field-space win f pos xpos)
(loop fields (1+ pos)))))))
(define (get-current-field form)
- 99/197: installer: Exit the format page after all partitions are successfully formatted., (continued)
- 99/197: installer: Exit the format page after all partitions are successfully formatted., Danny Milosavljevic, 2017/07/03
- 101/197: installer: Replace one usage of car with match., Danny Milosavljevic, 2017/07/03
- 109/197: installer: Fix bug where the selected item of main page was not indicated., Danny Milosavljevic, 2017/07/03
- 104/197: installer: Support btrfs, Danny Milosavljevic, 2017/07/03
- 111/197: gurses: Change highlighting from bold to inverse., Danny Milosavljevic, 2017/07/03
- 108/197: installer: Do not add file systems which are invalid., Danny Milosavljevic, 2017/07/03
- 164/197: gurses: Use match instead of car., Danny Milosavljevic, 2017/07/03
- 170/197: installer: Remove unused procedure., Danny Milosavljevic, 2017/07/03
- 152/197: installer: New file i18n.scm., Danny Milosavljevic, 2017/07/03
- 110/197: installer: Add an explanatory text to the main page., Danny Milosavljevic, 2017/07/03
- 120/197: gurses: Mini refactor.,
Danny Milosavljevic <=
- 124/197: gurses: Populate dropdown boxes in forms using a menu., Danny Milosavljevic, 2017/07/03
- 131/197: gurses: Use inverse instead of underline for field value area., Danny Milosavljevic, 2017/07/03
- 133/197: installer: Change livery., Danny Milosavljevic, 2017/07/03
- 146/197: gurses: Use match instead of car/cdr in line-split., Danny Milosavljevic, 2017/07/03
- 147/197: gurses: In paragraph-format avoid use of car and cdr., Danny Milosavljevic, 2017/07/03
- 144/197: gurses: Avoid one more use of car and cdr., Danny Milosavljevic, 2017/07/03
- 143/197: gurses: Add predicate to test if a complex char is blank., Danny Milosavljevic, 2017/07/03
- 149/197: gurses: Add new procedure "word-endings"., Danny Milosavljevic, 2017/07/03
- 155/197: installer: Use _ instead of M_ for host-name-refresh., Danny Milosavljevic, 2017/07/03
- 160/197: installer: New convenience procedures., Danny Milosavljevic, 2017/07/03