From 2e5b16437bfa5184d88c37bd92b2c94db2371f36 Mon Sep 17 00:00:00 2001 From: eknauel Date: Wed, 1 Jun 2005 08:07:48 +0000 Subject: [PATCH] Use files in (cwd) for completion if the partial-name is empty and the cursor is not on the command token --- scheme/nuit-engine.scm | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/scheme/nuit-engine.scm b/scheme/nuit-engine.scm index a4923be..c8746ba 100644 --- a/scheme/nuit-engine.scm +++ b/scheme/nuit-engine.scm @@ -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))