diff --git a/scheme/input-buffer.scm b/scheme/input-buffer.scm index 787ee64..b0a1034 100644 --- a/scheme/input-buffer.scm +++ b/scheme/input-buffer.scm @@ -67,7 +67,9 @@ (pos-col . ,buffer-pos-col) (pos-fin-ln . ,buffer-pos-fin-ln) (pos-y . ,buffer-pos-y) - (pos-x . ,buffer-pos-x)))))) + (pos-x . ,buffer-pos-x) + (history-pos . ,buffer-history-pos) + (lines . ,(lambda (b) (length (buffer-text b))))))))) (define (buffer-text-current-line buffer) (list-ref (buffer-text buffer) @@ -85,12 +87,12 @@ ;; enter key ((= ch 10) (set-buffer-text! buffer - (append (buffer-text buffer (list "")))) + (append (buffer-text buffer) (list ""))) (set-buffer-pos-line! buffer (+ (buffer-pos-line buffer) 1)) (set-buffer-pos-col! buffer first-column) (set-buffer-history-pos! buffer - (+ (length (buffer-text buffer)) 1))) + (- (length (buffer-text buffer)) 1))) ;; backspace ((and (= ch key-backspace) (buffer-can-write buffer)