Use files in (cwd) for completion if the partial-name is empty and the
cursor is not on the command token
This commit is contained in:
parent
145f79b654
commit
2e5b16437b
|
@ -327,7 +327,7 @@
|
|||
(loop (wait-for-input) #f maybe-selector)))
|
||||
|
||||
;; F7 toggle scheme-mode / command-mode (FIXME: find a better key)
|
||||
((= ch key-home)
|
||||
((= ch key-f7)
|
||||
(toggle-command/scheme-mode)
|
||||
(loop (wait-for-input) #f #f))
|
||||
|
||||
|
@ -348,6 +348,7 @@
|
|||
(= ch 112))
|
||||
(add-string-to-command-buffer
|
||||
(send (current-viewer) 'get-selection))
|
||||
(refresh-command-window)
|
||||
(loop (wait-for-input) #f #f))
|
||||
|
||||
((and c-x-pressed? (focus-on-result-buffer?))
|
||||
|
@ -747,15 +748,12 @@
|
|||
(complete-with-filesystem-objects
|
||||
(lambda (file) #t) partial-name))
|
||||
|
||||
(define (command-mode-completer command prefix args args-pos)
|
||||
(define (command-completer command prefix args args-pos)
|
||||
(debug-message "command-mode-completer" prefix "|" args "|" args-pos)
|
||||
(cond
|
||||
((command-contains-path? prefix)
|
||||
;; #### FIXME ignore errors here?
|
||||
((if (zero? args-pos)
|
||||
complete-executables/path
|
||||
complete-files/path)
|
||||
(expand-file-name prefix (cwd))))
|
||||
(complete-executables/path (expand-file-name prefix (cwd))))
|
||||
(else
|
||||
(append
|
||||
(completions-for (command-completions) prefix)
|
||||
|
@ -763,6 +761,11 @@
|
|||
(lambda ()
|
||||
(completions-for-executables executable-completions prefix)))))))
|
||||
|
||||
(define (file-completer command prefix args args-pos)
|
||||
(if (zero? (string-length prefix))
|
||||
(complete-files/path prefix)
|
||||
(complete-files/path (expand-file-name prefix (cwd)))))
|
||||
|
||||
(define (assemble-line-with-completion command arg arg-pos completion)
|
||||
(debug-message "assemble-line-with-completion "
|
||||
command "," arg "," arg-pos "," completion)
|
||||
|
@ -819,12 +822,12 @@
|
|||
(define (call-completer command args prefix arg-pos)
|
||||
(cond
|
||||
((= 0 arg-pos)
|
||||
(command-mode-completer command prefix args arg-pos))
|
||||
(command-completer command prefix args arg-pos))
|
||||
((completer-function-for-command command)
|
||||
=> (lambda (completer)
|
||||
(completer command prefix args arg-pos)))
|
||||
(else
|
||||
(command-mode-completer command prefix args arg-pos))))
|
||||
(file-completer command prefix args arg-pos))))
|
||||
|
||||
(define (offer-completions command)
|
||||
(let* ((tokens/cursor-list (tokenize-command command))
|
||||
|
|
Loading…
Reference in New Issue