make eval look whether the command is evaluated in command oder scheme
mode
This commit is contained in:
parent
75500100b3
commit
9a038dc356
|
@ -234,6 +234,32 @@
|
|||
(move-cursor command-buffer)
|
||||
(refresh-command-window))
|
||||
|
||||
(define (handle-return-key)
|
||||
(let ((command (last (buffer-text command-buffer))))
|
||||
(cond
|
||||
((string=? command "")
|
||||
(values))
|
||||
((command-buffer-in-scheme-mode?)
|
||||
(eval-command-in-scheme-mode command))
|
||||
((command-buffer-in-command-mode?)
|
||||
(eval-command-in-command-mode command)))))
|
||||
|
||||
(define (eval-command-in-command-mode command)
|
||||
(debug-message "eval-command-in-command-mode " command))
|
||||
|
||||
(define (eval-command-in-scheme-mode command)
|
||||
(call-with-values
|
||||
(lambda ()
|
||||
(execute-command command))
|
||||
(lambda (result plugin)
|
||||
(let ((new-entry
|
||||
(make-history-entry command '()
|
||||
result plugin)))
|
||||
;; FIXME, use insert here
|
||||
(append-to-history! new-entry)
|
||||
(buffer-text-append-new-line! command-buffer)
|
||||
(paint-result/command-buffer new-entry)))))
|
||||
|
||||
;; handle input
|
||||
(define (run)
|
||||
|
||||
|
@ -303,26 +329,8 @@
|
|||
(loop (wait-for-input) c-x-pressed?))
|
||||
|
||||
((= ch 10)
|
||||
(let ((command (last (buffer-text command-buffer))))
|
||||
(if (not (string=? command ""))
|
||||
(call-with-values
|
||||
(lambda ()
|
||||
(execute-command command))
|
||||
(lambda (result plugin)
|
||||
(let ((new-entry
|
||||
(make-history-entry command '()
|
||||
result plugin)))
|
||||
(append-to-history! new-entry)
|
||||
(buffer-text-append-new-line! command-buffer)
|
||||
(paint-result-window new-entry)
|
||||
(paint-active-command-window)
|
||||
(scroll-command-buffer)
|
||||
(paint-command-window-contents)
|
||||
(move-cursor command-buffer)
|
||||
(refresh-result-window)
|
||||
(refresh-command-window)
|
||||
(loop (wait-for-input) c-x-pressed?))))
|
||||
(loop (wait-for-input) #f))))
|
||||
(handle-return-key)
|
||||
(loop (wait-for-input) c-x-pressed?))
|
||||
|
||||
(else
|
||||
(cond
|
||||
|
@ -457,6 +465,15 @@
|
|||
(define (refresh-result-window)
|
||||
(wrefresh (app-window-curses-win result-window)))
|
||||
|
||||
(define (paint-result/command-buffer history-entry)
|
||||
(paint-result-window history-entry)
|
||||
(paint-active-command-window)
|
||||
(scroll-command-buffer)
|
||||
(paint-command-window-contents)
|
||||
(move-cursor command-buffer)
|
||||
(refresh-result-window)
|
||||
(refresh-command-window))
|
||||
|
||||
(define (paint)
|
||||
(debug-message "paint")
|
||||
(paint-bar-1)
|
||||
|
|
Loading…
Reference in New Issue