A first step towards completion: Add completion for command plugins
This commit is contained in:
parent
9b72181b54
commit
b93e71736c
|
@ -288,12 +288,13 @@
|
|||
((= ch key-control-x)
|
||||
(loop (wait-for-input) #t))
|
||||
|
||||
((= ch key-tab)
|
||||
(debug-message "Should do completion now")
|
||||
((and (focus-on-command-buffer?)
|
||||
(= ch key-tab))
|
||||
(offer-completions (last (buffer-text command-buffer)))
|
||||
(loop (wait-for-input) #f))
|
||||
|
||||
;; 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))
|
||||
|
||||
|
@ -740,6 +741,22 @@
|
|||
(loop (cdr lst)
|
||||
(string-append str " " (car lst))))))
|
||||
|
||||
(define (completions->select-list completions)
|
||||
(debug-message "possible completions " completions)
|
||||
(make-select-list
|
||||
(map (lambda (s) (make-unmarked-element s #f s))
|
||||
completions)
|
||||
(result-buffer-num-lines result-buffer)))
|
||||
|
||||
(define (offer-completions command)
|
||||
(debug-message "offer-completions " command)
|
||||
(let ((select-list
|
||||
(completions->select-list
|
||||
(completions-for (command-completions) command))))
|
||||
(wclear (app-window-curses-win result-window))
|
||||
(paint-result-buffer (paint-selection-list select-list))
|
||||
(refresh-result-window)))
|
||||
|
||||
(define-record-type standard-result-obj standard-result-obj
|
||||
(make-standard-result-obj cursor-pos-y
|
||||
cursor-pos-x
|
||||
|
|
Loading…
Reference in New Issue