diff --git a/scheme/completer.scm b/scheme/completer.scm index 7fd1497..bb0c05d 100644 --- a/scheme/completer.scm +++ b/scheme/completer.scm @@ -144,13 +144,16 @@ (list completed-line '() cursor-index to-complete parsed)))) (else (let ((common-prefix (strings-common-prefix completions))) - (call-with-values - (lambda () - (unparse-command-line - parsed (lambda (to-complete) - (display common-prefix)))) - (lambda (completed-line cursor-index) - (list completed-line completions cursor-index to-complete parsed))))))))))) + (debug-message "common-prefix is" common-prefix) + (if (string=? common-prefix "") + (list #f completions cursor-index to-complete parsed) + (call-with-values + (lambda () + (unparse-command-line + 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) diff --git a/scheme/nuit-engine.scm b/scheme/nuit-engine.scm index d1769c1..c214736 100644 --- a/scheme/nuit-engine.scm +++ b/scheme/nuit-engine.scm @@ -738,28 +738,30 @@ ;; #### beep or so #f) (destructure - (((completed-line completions cursor-index to-complete cmdln) completion-info)) - (cond - ((null? completions) - ;; #### don't ask - (display-completed-line completed-line (+ 2 cursor-index)) - #f) - ((list? completions) - (display-completed-line completed-line (+ 2 cursor-index)) - (let* ((select-list - (completions->select-list - completions - (- (result-buffer-num-lines (result-buffer)) 3))) - (selector - (make-completion-selector select-list completions - cmdln to-complete))) - (paint-completion-select-list select-list command) - (move-cursor (command-buffer) (result-buffer)) - (refresh-command-window) - selector)) - (else - (error "COMPLETE returned an unexpected value" - completions))))))) + (((maybe-completed-line completions cursor-index to-complete cmdln) completion-info)) + + (if maybe-completed-line + ;; #### don't ask about the 2... + (display-completed-line maybe-completed-line (+ 2 cursor-index))) + + (cond + ((null? completions) + #f) + ((list? completions) + (let* ((select-list + (completions->select-list + completions + (- (result-buffer-num-lines (result-buffer)) 3))) + (selector + (make-completion-selector select-list completions + cmdln to-complete))) + (paint-completion-select-list select-list command) + (move-cursor (command-buffer) (result-buffer)) + (refresh-command-window) + selector)) + (else + (error "COMPLETE returned an unexpected value" + completions))))))) (define (make-completion-selector select-list completions cmdln to-complete)