Receive key bindings only once from configuration

This commit is contained in:
mainzelm 2006-04-06 16:25:59 +00:00
parent f531958b62
commit 52f8656ee2
1 changed files with 6 additions and 3 deletions

View File

@ -253,14 +253,17 @@
(- (result-buffer-num-lines buffer) 1) (- (result-buffer-num-lines buffer) 1)
(result-buffer-num-cols buffer)))) (result-buffer-num-cols buffer))))
(define sort-up-key (config 'ls 'sort-up-key))
(define sort-down-key (config 'ls 'sort-down-key))
(define (handle-key-press self key) (define (handle-key-press self key)
(cond (cond
((= key key-return) ((= key key-return)
(handle-return-key (handle-return-key
self (select-list-selected-entry select-list) self (select-list-selected-entry select-list)
(calculate-number-of-lines buffer))) (calculate-number-of-lines buffer)))
((or (= key (config 'ls 'sort-up-key)) ((or (= key sort-up-key)
(= key (config 'ls 'sort-down-key))) (= key sort-down-key))
(let ((column (select-line-selected-entry select-line))) (let ((column (select-line-selected-entry select-line)))
(receive (compare-up compare-down select) (receive (compare-up compare-down select)
(case column (case column
@ -289,7 +292,7 @@
(file-info:mtime (fs-object-info fso))))) (file-info:mtime (fs-object-info fso)))))
(else (else
(error "unknown column" column))) (error "unknown column" column)))
(let ((compare (if (= key (config 'ls 'sort-up-key)) (let ((compare (if (= key sort-up-key)
compare-up compare-up
compare-down))) compare-down)))
(set-fs-objects! (set-fs-objects!