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