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