Change representation of ACTIVE-BUFFER

This commit is contained in:
eknauel 2005-05-11 06:54:03 +00:00
parent 2353335d5e
commit c4ef6ed09d
1 changed files with 22 additions and 11 deletions

View File

@ -114,7 +114,19 @@
;;-------------------
;;1....upper;2....lower
(define active-buffer 1)
(define *focus-buffer* 'command-buffer)
(define (focus-on-command-buffer?)
(eq? *focus-buffer* 'command-buffer))
(define (focus-command-buffer!)
(set! *focus-buffer* 'command-buffer))
(define (focus-on-result-buffer?)
(eq? *focus-buffer* 'result-buffer))
(define (focus-result-buffer!)
(set! *focus-buffer* 'result-buffer))
;;History
(define history '())
@ -265,7 +277,7 @@
((= ch 24)
(begin
(set! c-x-pressed (not c-x-pressed))
(if (= active-buffer 2)
(if (focus-on-result-buffer?)
(let ((key-message
(make-key-pressed-message active-command
current-result-object
@ -294,15 +306,15 @@
;;Ctrl-x o ->switch buffer
((= ch 111)
(begin
(if (= active-buffer 1)
(if (focus-on-command-buffer?)
(begin
(set! active-buffer 2)
(focus-result-buffer!)
(let ((key-message
(make-key-pressed-message active-command
current-result-object
97)))
(set! current-result-object (switch key-message))))
(set! active-buffer 1))
(focus-command-buffer!))
(set! c-x-pressed #f)
(loop (wait-for-input))))
@ -329,7 +341,7 @@
(else
(begin
(if (= active-buffer 2)
(if (focus-on-result-buffer?)
(let ((key-message
(make-key-pressed-message active-command
current-result-object
@ -345,7 +357,7 @@
(set! c-x-pressed #f)
(loop (wait-for-input)))))
(if (= active-buffer 2)
(if (focus-on-result-buffer?)
(let ((key-message
(make-key-pressed-message active-command
current-result-object
@ -796,7 +808,7 @@
(string-append start-line "..." end-line))
line)))
(if (and (member pos highlighted-lines)
(= active-buffer 2))
(focus-on-result-buffer?))
(begin
(wattron window (A-REVERSE))
(mvwaddstr window pos 1 line)
@ -858,7 +870,7 @@
(define cur-right-pos
(lambda (comwin reswin comwin-h reswin-h buffer)
(begin
(if (= active-buffer 1)
(if (focus-on-command-buffer?)
(cursor-right-pos comwin buffer)
(begin
(compute-y-x)
@ -870,7 +882,7 @@
;;compue pos-x and pos-y
(define compute-y-x
(lambda ()
(if (= active-buffer 1)
(if (focus-on-command-buffer?)
(begin
(if (>= pos-command-fin-ln command-lines)
(set! command-buffer-pos-y command-lines)
@ -996,7 +1008,6 @@
(set! result-cols 0)
(set! highlighted-lines '())
(set! marked-lines '())
(set! active-buffer 1)
(set! history '())
(set! history-pos 0)
(set! active-command "")