Two minor fixes to enhance completion of directory names
This commit is contained in:
parent
4320c730db
commit
f07e7fc932
|
@ -40,7 +40,8 @@
|
|||
|
||||
(define (complete-with-filesystem-objects filter partial-name)
|
||||
(debug-message "complete-with-filesystem-objects " filter " " partial-name)
|
||||
(if (file-exists-and-is-directory? partial-name)
|
||||
(if (and (file-name-directory? partial-name)
|
||||
(file-exists-and-is-directory? partial-name))
|
||||
(files-in-dir filter partial-name)
|
||||
(filter-map filter (complete-path partial-name))))
|
||||
|
||||
|
@ -73,10 +74,18 @@
|
|||
(debug-message "find-completions-for-arg " cmd "," to-complete)
|
||||
(let ((prefix (to-complete-prefix to-complete)))
|
||||
(complete-with-filesystem-objects
|
||||
(if prefix
|
||||
(lambda (file)
|
||||
(and (string-prefix? prefix file) file))
|
||||
(lambda (file) file))
|
||||
(lambda (file)
|
||||
(call-with-current-continuation
|
||||
(lambda (esc)
|
||||
(with-handler
|
||||
(lambda (c more)
|
||||
(if (error? c)
|
||||
(esc #f)
|
||||
(more)))
|
||||
(lambda ()
|
||||
(if (file-directory? file)
|
||||
(file-name-as-directory file)
|
||||
file))))))
|
||||
(or (to-complete-prefix to-complete) (cwd)))))
|
||||
|
||||
;; #### no special treatment yet
|
||||
|
|
|
@ -485,6 +485,8 @@
|
|||
(subset scsh
|
||||
(file-name-directory glob with-cwd cwd
|
||||
file-name-extension
|
||||
file-name-as-directory
|
||||
file-name-directory?
|
||||
absolute-file-name expand-file-name
|
||||
file-exists? file-directory? file-executable?
|
||||
directory-files getenv))
|
||||
|
|
Loading…
Reference in New Issue