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:
eknauel 2005-06-01 08:07:48 +00:00
parent 145f79b654
commit 2e5b16437b
1 changed files with 11 additions and 8 deletions

View File

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