make it easier to abort the process of choosing a completion via the select-list

This commit is contained in:
eknauel 2005-05-30 15:38:13 +00:00
parent eeaaa729ac
commit 54230412f8
3 changed files with 30 additions and 13 deletions

View File

@ -295,6 +295,7 @@
(let loop ((ch (wait-for-input)) (c-x-pressed? #f) (let loop ((ch (wait-for-input)) (c-x-pressed? #f)
(completion-selector #f)) (completion-selector #f))
(debug-message "loop: " ch "|" c-x-pressed? "|" completion-selector)
(cond (cond
;; Ctrl-x -> wait for next input ;; Ctrl-x -> wait for next input
@ -487,7 +488,8 @@
(with-lock executable-completions-lock (with-lock executable-completions-lock
(lambda() (lambda()
(set! executable-completions (set! executable-completions
(make-completion-set-for-executables (get-path-list)))))))) (make-completion-set-for-executables (get-path-list)))
(debug-message "finished scanning executable-completions-set"))))))
(define (paint-bar-1) (define (paint-bar-1)
(mvwaddstr (app-window-curses-win bar-1) 0 1 "SCSH-NUIT") (mvwaddstr (app-window-curses-win bar-1) 0 1 "SCSH-NUIT")
@ -955,17 +957,22 @@
(select-list-selected-entry select-list))) (select-list-selected-entry select-list)))
display-completed-line) display-completed-line)
#f) #f)
(else ((or (select-list-navigation-key? key)
(let ((new-select-list (select-list-marking-key? key))
(select-list-handle-key-press (let ((new-select-list
select-list (select-list-handle-key-press
(make-key-pressed-message select-list
(active-command) (current-result) (make-key-pressed-message
result-buffer key #f)))) (active-command) (current-result)
(paint-completion-select-list result-buffer key #f))))
new-select-list (last (buffer-text command-buffer))) (paint-completion-select-list
(make-completion-selector new-select-list (last (buffer-text command-buffer)))
new-select-list completions command arg arg-pos)))))) (make-completion-selector
new-select-list completions command arg arg-pos)))
(else
;; #### FIXME we loose a character this way
(focus-command-buffer!)
#f))))
(define (find-token-with-cursor tokens/cursor-list) (define (find-token-with-cursor tokens/cursor-list)
(debug-message "find-token-with-cursor " tokens/cursor-list) (debug-message "find-token-with-cursor " tokens/cursor-list)

View File

@ -156,7 +156,10 @@
paint-selection-list paint-selection-list
paint-selection-list-at paint-selection-list-at
select-list-get-selection select-list-get-selection
select-list-selected-entry)) select-list-selected-entry
select-list-navigation-key?
select-list-marking-key?))
(define-structure select-list select-list-interface (define-structure select-list select-list-interface
(open scheme (open scheme

View File

@ -40,6 +40,7 @@
(define (select-list-handle-key-press select-list key-message) (define (select-list-handle-key-press select-list key-message)
(let ((key (key-pressed-message-key key-message)) (let ((key (key-pressed-message-key key-message))
(result-buffer (key-pressed-message-result-buffer key-message))) (result-buffer (key-pressed-message-result-buffer key-message)))
(debug-message "select-list-handle-key-press " select-list " " key)
(cond (cond
((= key key-m) ((= key key-m)
(mark-current-line select-list)) (mark-current-line select-list))
@ -52,6 +53,12 @@
(else (else
select-list)))) select-list))))
(define (select-list-navigation-key? key)
(or (= key key-up) (= key key-down)))
(define (select-list-marking-key? key)
(or (= key key-m) (= key key-u)))
(define (mark/unmark-current-line-maker mark) (define (mark/unmark-current-line-maker mark)
(lambda (select-list) (lambda (select-list)
(let* ((index (select-list-cursor-index select-list)) (let* ((index (select-list-cursor-index select-list))