Minor code clean-up, fix more redrawing stuff

This commit is contained in:
eknauel 2005-05-17 09:00:33 +00:00
parent 88e805e52a
commit 03ffcf8280
1 changed files with 62 additions and 71 deletions

View File

@ -333,9 +333,9 @@
(make-key-pressed-message active-command (make-key-pressed-message active-command
current-result-object current-result-object
ch))) ch)))
(begin
(set! current-result-object (switch key-message)) (set! current-result-object (switch key-message))
(loop (wait-for-input)))) (paint-result-window)
(loop (wait-for-input)))
(cond (cond
@ -344,7 +344,6 @@
(let ((restore-message (make-restore-message (let ((restore-message (make-restore-message
active-command active-command
current-result-object))) current-result-object)))
(begin
(switch restore-message) (switch restore-message)
(execute-command) (execute-command)
(set-buffer-history-pos! (set-buffer-history-pos!
@ -354,15 +353,13 @@
(paint-bar-2) (paint-bar-2)
(paint-command-window-contents) (paint-command-window-contents)
(move-cursor command-buffer) (move-cursor command-buffer)
(loop (wait-for-input))))) (loop (wait-for-input))))
(else (else
(begin
(set! command-buffer (input command-buffer ch)) (set! command-buffer (input command-buffer ch))
(paint-command-window-contents) (paint-command-window-contents)
(set! command-buffer (move-cursor command-buffer)
(move-cursor command-buffer)) (loop (wait-for-input))))))))))
(loop (wait-for-input)))))))))))
(define (window-init-curses-win! window) (define (window-init-curses-win! window)
(set-app-window-curses-win! (set-app-window-curses-win!
@ -452,8 +449,7 @@
;;If the user presses enter the last line is interpreted as a command ;;If the user presses enter the last line is interpreted as a command
;;which has to be executed. ;;which has to be executed.
(define execute-command (define (execute-command)
(lambda ()
(let* ((com (list-ref (buffer-text command-buffer) (let* ((com (list-ref (buffer-text command-buffer)
(- (length (buffer-text command-buffer)) 1))) (- (length (buffer-text command-buffer)) 1)))
(com-par (extract-com-and-par com)) (com-par (extract-com-and-par com))
@ -463,7 +459,6 @@
(message (make-next-command-message (message (make-next-command-message
command parameters result-cols)) command parameters result-cols))
(model (switch message))) (model (switch message)))
(begin
(if (not (= history-pos 0)) (if (not (= history-pos 0))
(let ((hist-entry (make-history-entry active-command (let ((hist-entry (make-history-entry active-command
active-parameters active-parameters
@ -471,20 +466,18 @@
(active (make-history-entry command (active (make-history-entry command
(get-param-as-str parameters) (get-param-as-str parameters)
model))) model)))
(begin
(if (< history-pos (length history)) (if (< history-pos (length history))
(set! history (append history (list hist-entry))) (set! history (append history (list hist-entry)))
(set! history (append (set! history (append
(sublist history 0 (sublist history 0
(- (length history) 1)) (- (length history) 1))
(list hist-entry) (list active)))) (list hist-entry) (list active))))
(set! history-pos (length history)))) (set! history-pos (length history)))
(let ((hist-entry (make-history-entry (let ((hist-entry (make-history-entry
command command
(get-param-as-str parameters) model))) (get-param-as-str parameters) model)))
(begin
(set! history (list hist-entry)) (set! history (list hist-entry))
(set! history-pos 1)))) (set! history-pos 1)))
(set-buffer-text! command-buffer (set-buffer-text! command-buffer
(append (buffer-text command-buffer) (append (buffer-text command-buffer)
@ -492,7 +485,7 @@
(set! active-command command) (set! active-command command)
(set! active-parameters (get-param-as-str parameters)) (set! active-parameters (get-param-as-str parameters))
(set! current-result-object model) (set! current-result-object model)
(scroll-command-buffer))))) (scroll-command-buffer)))
;;Extracts the name of the function and its parameters ;;Extracts the name of the function and its parameters
(define extract-com-and-par (define extract-com-and-par
@ -784,7 +777,6 @@
;;Cursor ;;Cursor
;;move cursor to the corrct position ;;move cursor to the corrct position
(define (move-cursor buffer) (define (move-cursor buffer)
(begin
(if (focus-on-command-buffer?) (if (focus-on-command-buffer?)
(cursor-right-pos (app-window-curses-win command-window) (cursor-right-pos (app-window-curses-win command-window)
buffer) buffer)
@ -792,8 +784,7 @@
(compute-y-x) (compute-y-x)
(wmove (app-window-curses-win result-window) (wmove (app-window-curses-win result-window)
result-buffer-pos-y result-buffer-pos-x) result-buffer-pos-y result-buffer-pos-x)
(wrefresh (app-window-curses-win result-window)) (wrefresh (app-window-curses-win result-window)))))
buffer))))
;;compue pos-x and pos-y ;;compue pos-x and pos-y
(define compute-y-x (define compute-y-x