Take care of completions that do *not* alter the command line

This commit is contained in:
mainzelm 2005-09-12 15:55:58 +00:00
parent 41ac17dbe6
commit 07555260e1
2 changed files with 34 additions and 29 deletions

View File

@ -144,13 +144,16 @@
(list completed-line '() cursor-index to-complete parsed)))) (list completed-line '() cursor-index to-complete parsed))))
(else (else
(let ((common-prefix (strings-common-prefix completions))) (let ((common-prefix (strings-common-prefix completions)))
(call-with-values (debug-message "common-prefix is" common-prefix)
(lambda () (if (string=? common-prefix "")
(unparse-command-line (list #f completions cursor-index to-complete parsed)
parsed (lambda (to-complete) (call-with-values
(display common-prefix)))) (lambda ()
(lambda (completed-line cursor-index) (unparse-command-line
(list completed-line completions cursor-index to-complete parsed))))))))))) parsed (lambda (to-complete)
(display common-prefix))))
(lambda (completed-line cursor-index)
(list completed-line completions cursor-index to-complete parsed))))))))))))
(define (strings-common-prefix strs) (define (strings-common-prefix strs)

View File

@ -738,28 +738,30 @@
;; #### beep or so ;; #### beep or so
#f) #f)
(destructure (destructure
(((completed-line completions cursor-index to-complete cmdln) completion-info)) (((maybe-completed-line completions cursor-index to-complete cmdln) completion-info))
(cond
((null? completions) (if maybe-completed-line
;; #### don't ask ;; #### don't ask about the 2...
(display-completed-line completed-line (+ 2 cursor-index)) (display-completed-line maybe-completed-line (+ 2 cursor-index)))
#f)
((list? completions) (cond
(display-completed-line completed-line (+ 2 cursor-index)) ((null? completions)
(let* ((select-list #f)
(completions->select-list ((list? completions)
completions (let* ((select-list
(- (result-buffer-num-lines (result-buffer)) 3))) (completions->select-list
(selector completions
(make-completion-selector select-list completions (- (result-buffer-num-lines (result-buffer)) 3)))
cmdln to-complete))) (selector
(paint-completion-select-list select-list command) (make-completion-selector select-list completions
(move-cursor (command-buffer) (result-buffer)) cmdln to-complete)))
(refresh-command-window) (paint-completion-select-list select-list command)
selector)) (move-cursor (command-buffer) (result-buffer))
(else (refresh-command-window)
(error "COMPLETE returned an unexpected value" selector))
completions))))))) (else
(error "COMPLETE returned an unexpected value"
completions)))))))
(define (make-completion-selector select-list completions (define (make-completion-selector select-list completions
cmdln to-complete) cmdln to-complete)