From 1ccfa8dccce3844be97fbec8e31ab513afd29756 Mon Sep 17 00:00:00 2001 From: eknauel Date: Sun, 22 May 2005 09:18:07 +0000 Subject: [PATCH] add function buffer-text-append-new-line! --- scheme/input-buffer.scm | 47 ++++++++++++++++++++----------------- scheme/ncurses-packages.scm | 2 ++ 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/scheme/input-buffer.scm b/scheme/input-buffer.scm index 81a1558..787ee64 100644 --- a/scheme/input-buffer.scm +++ b/scheme/input-buffer.scm @@ -73,6 +73,11 @@ (list-ref (buffer-text buffer) (- (buffer-pos-line buffer) 1))) +(define (buffer-text-append-new-line! buffer) + (set-buffer-text! buffer + (append (buffer-text buffer) + (list "")))) + ;;handle input (define (input buffer ch) (cond @@ -318,23 +323,23 @@ (new-y (- (+ (- pos-fin-ln no-wrapped-lines) first-line-offset) 1))) - (debug-message "num-cols " - num-cols - " no-wrapped-lines " - no-wrapped-lines - " first-line-offset " - first-line-offset - " new-y " new-y - " length " - item-length - " pos-fin-ln " - pos-fin-ln - " text-index " - text-index - " pos-line " - (buffer-pos-line buffer) - " num-lines " - num-lines) +; (debug-message "num-cols " +; num-cols +; " no-wrapped-lines " +; no-wrapped-lines +; " first-line-offset " +; first-line-offset +; " new-y " new-y +; " length " +; item-length +; " pos-fin-ln " +; pos-fin-ln +; " text-index " +; text-index +; " pos-line " +; (buffer-pos-line buffer) +; " num-lines " +; num-lines) ; (if (and (not (zero? text-index)) ; (zero? (remainder text-index num-cols)) @@ -368,10 +373,10 @@ (set-buffer-pos-x! buffer (+ first-column (modulo text-index num-cols))) - (debug-message "cursor position " - (buffer-pos-x buffer) - " " - (buffer-pos-y buffer)) +; (debug-message "cursor position " +; (buffer-pos-x buffer) +; " " +; (buffer-pos-y buffer)) ; (debug-message "num-cols " num-cols ; " pos-col " pos-col ; " text '" (buffer-text-current-line buffer) "'") diff --git a/scheme/ncurses-packages.scm b/scheme/ncurses-packages.scm index cb925b3..08458bc 100644 --- a/scheme/ncurses-packages.scm +++ b/scheme/ncurses-packages.scm @@ -361,6 +361,8 @@ buffer-history-pos set-buffer-history-pos! make-buffer + buffer-text-current-line + buffer-text-append-new-line! input print-command-buffer cursor-right-pos