split PAINT into PAINT and WAIT-FOR-INPUT. Call PRINT-RESULT-BUFFER

to redraw only the result-buffer.
This commit is contained in:
eknauel 2005-05-10 16:06:06 +00:00
parent c9f6b17692
commit 599021b937
1 changed files with 100 additions and 100 deletions

View File

@ -248,7 +248,8 @@
(set! active-keyboard-interrupt a))) (set! active-keyboard-interrupt a)))
;;Loop ;;Loop
(let loop ((ch (paint))) (paint)
(let loop ((ch (wait-for-input)))
(cond (cond
;;The result of pressing these keys is independent of which ;;The result of pressing these keys is independent of which
@ -278,17 +279,20 @@
current-result-object current-result-object
ch))) ch)))
(set! current-result-object (switch key-message)))) (set! current-result-object (switch key-message))))
(loop (paint)))) (paint)
(loop (wait-for-input))))
;; forward in result history ;; forward in result history
((= ch key-npage) ((= ch key-npage)
(history-forward) (history-forward)
(loop (paint))) (print-result-buffer result-win)
(loop (wait-for-input)))
;; back in result history ;; back in result history
((= ch key-ppage) ((= ch key-ppage)
(history-back) (history-back)
(loop (paint))) (print-result-buffer result-win)
(loop (wait-for-input)))
;;if lower window is active a message is sent. ;;if lower window is active a message is sent.
@ -309,7 +313,7 @@
(set! current-result-object (switch key-message)))) (set! current-result-object (switch key-message))))
(set! active-buffer 1)) (set! active-buffer 1))
(set! c-x-pressed #f) (set! c-x-pressed #f)
(loop (paint)))) (loop (wait-for-input))))
;;C-x r -> redo ;;C-x r -> redo
((= ch 114) ((= ch 114)
@ -330,7 +334,7 @@
(run))) (run)))
(begin (begin
(set! c-x-pressed #f) (set! c-x-pressed #f)
(loop (paint))))) (loop (wait-for-input)))))
(else (else
(begin (begin
@ -348,7 +352,7 @@
(marked-items (switch message))) (marked-items (switch message)))
(add-string-to-command-buffer marked-items)))) (add-string-to-command-buffer marked-items))))
(set! c-x-pressed #f) (set! c-x-pressed #f)
(loop (paint))))) (loop (wait-for-input)))))
(if (= active-buffer 2) (if (= active-buffer 2)
(let ((key-message (let ((key-message
@ -357,7 +361,7 @@
ch))) ch)))
(begin (begin
(set! current-result-object (switch key-message)) (set! current-result-object (switch key-message))
(loop (paint)))) (loop (wait-for-input))))
(cond (cond
@ -431,15 +435,12 @@
(set! command-cols num-cols) (set! command-cols num-cols)
(set! can-write-command can-write) (set! can-write-command can-write)
(set! command-history-pos history-pos))) (set! command-history-pos history-pos)))
(loop (paint))))))))))))) (paint)
(loop (wait-for-input)))))))))))))
;;print and wait for input ;;print and wait for input
(define paint (define (paint)
(lambda ()
(begin
(init-screen) (init-screen)
;(cbreak)
(let* ((bar1-y 1) (let* ((bar1-y 1)
(bar1-x 1) (bar1-x 1)
(bar1-h 2) (bar1-h 2)
@ -530,16 +531,15 @@
; (wrefresh result-win) ; (wrefresh result-win)
; (wrefresh bar1) ; (wrefresh bar1)
; (wrefresh bar2) ; (wrefresh bar2)
))
(define (wait-for-input)
(noecho) (noecho)
(keypad bar1 #t) (keypad bar1 #t)
(set! active-keyboard-interrupt #f) (set! active-keyboard-interrupt #f)
(let ((ch (wgetch bar1))) (let ((ch (wgetch bar1)))
(echo) (echo)
ch ch))
)))))
;;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.