From c4ef6ed09de858f1bc308c07940f1f1a1b38a4dd Mon Sep 17 00:00:00 2001 From: eknauel Date: Wed, 11 May 2005 06:54:03 +0000 Subject: [PATCH] Change representation of ACTIVE-BUFFER --- scheme/nuit-engine.scm | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/scheme/nuit-engine.scm b/scheme/nuit-engine.scm index 3197a51..44cb283 100644 --- a/scheme/nuit-engine.scm +++ b/scheme/nuit-engine.scm @@ -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 "")