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