deal with empty prefix when trying to display common prefix

This commit is contained in:
mainzelm 2006-04-06 16:04:38 +00:00
parent ca30df1cd7
commit c232be69a1
1 changed files with 8 additions and 5 deletions

View File

@ -143,11 +143,13 @@
(lambda (completed-line cursor-index) (lambda (completed-line cursor-index)
(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))
(prefix (to-complete-prefix to-complete)))
(debug-message "common-prefix is" common-prefix) (debug-message "common-prefix is" common-prefix)
(if (<= (string-length common-prefix) (if (> (string-length common-prefix)
(string-length (to-complete-prefix to-complete))) (if prefix
(list #f completions cursor-index to-complete parsed) (string-length prefix)
0))
(call-with-values (call-with-values
(lambda () (lambda ()
(unparse-command-line (unparse-command-line
@ -155,7 +157,8 @@
(display common-prefix)))) (display common-prefix))))
(lambda (completed-line cursor-index) (lambda (completed-line cursor-index)
(list completed-line '() (list completed-line '()
cursor-index to-complete parsed)))))))))))) cursor-index to-complete parsed)))
(list #f completions cursor-index to-complete parsed))))))))))
(define (strings-common-prefix strs) (define (strings-common-prefix strs)