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)
(completion-selector #f))
(debug-message "loop: " ch "|" c-x-pressed? "|" completion-selector)
(cond
;; Ctrl-x -> wait for next input
@ -487,7 +488,8 @@
(with-lock executable-completions-lock
(lambda()
(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)
(mvwaddstr (app-window-curses-win bar-1) 0 1 "SCSH-NUIT")
@ -955,17 +957,22 @@
(select-list-selected-entry select-list)))
display-completed-line)
#f)
(else
(let ((new-select-list
(select-list-handle-key-press
select-list
(make-key-pressed-message
(active-command) (current-result)
result-buffer key #f))))
(paint-completion-select-list
new-select-list (last (buffer-text command-buffer)))
(make-completion-selector
new-select-list completions command arg arg-pos))))))
((or (select-list-navigation-key? key)
(select-list-marking-key? key))
(let ((new-select-list
(select-list-handle-key-press
select-list
(make-key-pressed-message
(active-command) (current-result)
result-buffer key #f))))
(paint-completion-select-list
new-select-list (last (buffer-text command-buffer)))
(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)
(debug-message "find-token-with-cursor " tokens/cursor-list)

View File

@ -156,7 +156,10 @@
paint-selection-list
paint-selection-list-at
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
(open scheme

View File

@ -40,6 +40,7 @@
(define (select-list-handle-key-press select-list key-message)
(let ((key (key-pressed-message-key key-message))
(result-buffer (key-pressed-message-result-buffer key-message)))
(debug-message "select-list-handle-key-press " select-list " " key)
(cond
((= key key-m)
(mark-current-line select-list))
@ -52,6 +53,12 @@
(else
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)
(lambda (select-list)
(let* ((index (select-list-cursor-index select-list))