split PAINT into PAINT and WAIT-FOR-INPUT. Call PRINT-RESULT-BUFFER
to redraw only the result-buffer.
This commit is contained in:
parent
c9f6b17692
commit
599021b937
|
@ -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,115 +435,111 @@
|
||||||
(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 ()
|
(init-screen)
|
||||||
(begin
|
(let* ((bar1-y 1)
|
||||||
(init-screen)
|
(bar1-x 1)
|
||||||
;(cbreak)
|
(bar1-h 2)
|
||||||
(let* ((bar1-y 1)
|
(bar1-w (- (COLS) 2))
|
||||||
(bar1-x 1)
|
(bar2-y (+ (round (/ (LINES) 3)) 2))
|
||||||
(bar1-h 2)
|
(bar2-x 1)
|
||||||
(bar1-w (- (COLS) 2))
|
(bar2-h 3)
|
||||||
(bar2-y (+ (round (/ (LINES) 3)) 2))
|
(bar2-w (- (COLS) 2))
|
||||||
(bar2-x 1)
|
(comwin-y 2)
|
||||||
(bar2-h 3)
|
(comwin-x 1)
|
||||||
(bar2-w (- (COLS) 2))
|
(comwin-h (- bar2-y 2))
|
||||||
(comwin-y 2)
|
(comwin-w (- (COLS) 2))
|
||||||
(comwin-x 1)
|
(reswin-y (+ bar2-y 3))
|
||||||
(comwin-h (- bar2-y 2))
|
(reswin-x 1)
|
||||||
(comwin-w (- (COLS) 2))
|
(reswin-h (- (- (LINES) 6) comwin-h))
|
||||||
(reswin-y (+ bar2-y 3))
|
(reswin-w (- (COLS) 2)))
|
||||||
(reswin-x 1)
|
|
||||||
(reswin-h (- (- (LINES) 6) comwin-h))
|
|
||||||
(reswin-w (- (COLS) 2)))
|
|
||||||
|
|
||||||
(wclear bar1)
|
(wclear bar1)
|
||||||
(wclear bar2)
|
(wclear bar2)
|
||||||
(wclear command-win)
|
(wclear command-win)
|
||||||
(wclear result-win)
|
(wclear result-win)
|
||||||
(clear)
|
(clear)
|
||||||
|
|
||||||
(set! bar1 (newwin bar1-h bar1-w bar1-y bar1-x))
|
(set! bar1 (newwin bar1-h bar1-w bar1-y bar1-x))
|
||||||
(set! bar2 (newwin bar2-h bar2-w bar2-y bar2-x))
|
(set! bar2 (newwin bar2-h bar2-w bar2-y bar2-x))
|
||||||
(set! command-win (newwin comwin-h comwin-w comwin-y comwin-x))
|
(set! command-win (newwin comwin-h comwin-w comwin-y comwin-x))
|
||||||
(set! result-win (newwin reswin-h reswin-w reswin-y reswin-x))
|
(set! result-win (newwin reswin-h reswin-w reswin-y reswin-x))
|
||||||
|
|
||||||
;(box standard-screen (ascii->char 0) (ascii->char 0))
|
;(box standard-screen (ascii->char 0) (ascii->char 0))
|
||||||
;(refresh)
|
;(refresh)
|
||||||
(mvwaddstr bar1 0 1 "SCSH-NUIT")
|
(mvwaddstr bar1 0 1 "SCSH-NUIT")
|
||||||
(wrefresh bar1)
|
(wrefresh bar1)
|
||||||
|
|
||||||
(box bar2 (ascii->char 0) (ascii->char 0))
|
(box bar2 (ascii->char 0) (ascii->char 0))
|
||||||
(print-active-command-win bar2 bar2-w)
|
(print-active-command-win bar2 bar2-w)
|
||||||
|
|
||||||
(box command-win (ascii->char 0) (ascii->char 0))
|
(box command-win (ascii->char 0) (ascii->char 0))
|
||||||
(set! command-lines (- comwin-h 2))
|
(set! command-lines (- comwin-h 2))
|
||||||
(set! command-cols (- comwin-w 3))
|
(set! command-cols (- comwin-w 3))
|
||||||
|
|
||||||
(set! command-buffer (make-buffer text-command
|
(set! command-buffer (make-buffer text-command
|
||||||
pos-command
|
pos-command
|
||||||
pos-command-col
|
pos-command-col
|
||||||
pos-command-fin-ln
|
pos-command-fin-ln
|
||||||
command-buffer-pos-y
|
command-buffer-pos-y
|
||||||
command-buffer-pos-x
|
command-buffer-pos-x
|
||||||
command-lines
|
command-lines
|
||||||
command-cols
|
command-cols
|
||||||
can-write-command
|
can-write-command
|
||||||
command-history-pos))
|
command-history-pos))
|
||||||
|
|
||||||
(set! command-buffer (print-command-buffer command-win command-buffer))
|
(set! command-buffer (print-command-buffer command-win command-buffer))
|
||||||
|
|
||||||
(wrefresh command-win)
|
(wrefresh command-win)
|
||||||
(box result-win (ascii->char 0) (ascii->char 0))
|
(box result-win (ascii->char 0) (ascii->char 0))
|
||||||
(set! result-lines (- reswin-h 2))
|
(set! result-lines (- reswin-h 2))
|
||||||
(set! result-cols (- reswin-w 3))
|
(set! result-cols (- reswin-w 3))
|
||||||
(print-result-buffer result-win)
|
(print-result-buffer result-win)
|
||||||
(wrefresh result-win)
|
(wrefresh result-win)
|
||||||
|
|
||||||
(set! command-buffer (cur-right-pos command-win result-win comwin-h
|
(set! command-buffer (cur-right-pos command-win result-win comwin-h
|
||||||
reswin-h command-buffer))
|
reswin-h command-buffer))
|
||||||
|
|
||||||
(let ((text (buffer-text command-buffer))
|
(let ((text (buffer-text command-buffer))
|
||||||
(pos-line (buffer-pos-line command-buffer))
|
(pos-line (buffer-pos-line command-buffer))
|
||||||
(pos-col (buffer-pos-col command-buffer))
|
(pos-col (buffer-pos-col command-buffer))
|
||||||
(pos-fin-ln (buffer-pos-fin-ln command-buffer))
|
(pos-fin-ln (buffer-pos-fin-ln command-buffer))
|
||||||
(pos-y (buffer-pos-y command-buffer))
|
(pos-y (buffer-pos-y command-buffer))
|
||||||
(pos-x (buffer-pos-x command-buffer))
|
(pos-x (buffer-pos-x command-buffer))
|
||||||
(num-lines (buffer-num-lines command-buffer))
|
(num-lines (buffer-num-lines command-buffer))
|
||||||
(num-cols (buffer-num-cols command-buffer))
|
(num-cols (buffer-num-cols command-buffer))
|
||||||
(can-write (buffer-can-write command-buffer))
|
(can-write (buffer-can-write command-buffer))
|
||||||
(history-pos (buffer-history-pos command-buffer)))
|
(history-pos (buffer-history-pos command-buffer)))
|
||||||
(begin
|
(begin
|
||||||
(set! text-command text)
|
(set! text-command text)
|
||||||
(set! pos-command pos-line)
|
(set! pos-command pos-line)
|
||||||
(set! pos-command-col pos-col)
|
(set! pos-command-col pos-col)
|
||||||
(set! pos-command-fin-ln pos-fin-ln)
|
(set! pos-command-fin-ln pos-fin-ln)
|
||||||
(set! command-buffer-pos-y pos-y)
|
(set! command-buffer-pos-y pos-y)
|
||||||
(set! command-buffer-pos-x pos-x)
|
(set! command-buffer-pos-x pos-x)
|
||||||
(set! command-lines num-lines)
|
(set! command-lines num-lines)
|
||||||
(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)))
|
||||||
|
|
||||||
;(refresh)
|
;(refresh)
|
||||||
; (wrefresh command-win)
|
; (wrefresh command-win)
|
||||||
; (wrefresh result-win)
|
; (wrefresh result-win)
|
||||||
; (wrefresh bar1)
|
; (wrefresh bar1)
|
||||||
; (wrefresh bar2)
|
; (wrefresh bar2)
|
||||||
|
))
|
||||||
|
|
||||||
(noecho)
|
|
||||||
(keypad bar1 #t)
|
|
||||||
(set! active-keyboard-interrupt #f)
|
|
||||||
(let ((ch (wgetch bar1)))
|
|
||||||
(echo)
|
|
||||||
ch
|
|
||||||
)))))
|
|
||||||
|
|
||||||
|
(define (wait-for-input)
|
||||||
|
(noecho)
|
||||||
|
(keypad bar1 #t)
|
||||||
|
(set! active-keyboard-interrupt #f)
|
||||||
|
(let ((ch (wgetch bar1)))
|
||||||
|
(echo)
|
||||||
|
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.
|
||||||
|
|
Loading…
Reference in New Issue