add function buffer-text-append-new-line!

This commit is contained in:
eknauel 2005-05-22 09:18:07 +00:00
parent fefb4b002d
commit 1ccfa8dccc
2 changed files with 28 additions and 21 deletions

View File

@ -73,6 +73,11 @@
(list-ref (buffer-text buffer) (list-ref (buffer-text buffer)
(- (buffer-pos-line buffer) 1))) (- (buffer-pos-line buffer) 1)))
(define (buffer-text-append-new-line! buffer)
(set-buffer-text! buffer
(append (buffer-text buffer)
(list ""))))
;;handle input ;;handle input
(define (input buffer ch) (define (input buffer ch)
(cond (cond
@ -318,23 +323,23 @@
(new-y (- (+ (- pos-fin-ln no-wrapped-lines) (new-y (- (+ (- pos-fin-ln no-wrapped-lines)
first-line-offset) first-line-offset)
1))) 1)))
(debug-message "num-cols " ; (debug-message "num-cols "
num-cols ; num-cols
" no-wrapped-lines " ; " no-wrapped-lines "
no-wrapped-lines ; no-wrapped-lines
" first-line-offset " ; " first-line-offset "
first-line-offset ; first-line-offset
" new-y " new-y ; " new-y " new-y
" length " ; " length "
item-length ; item-length
" pos-fin-ln " ; " pos-fin-ln "
pos-fin-ln ; pos-fin-ln
" text-index " ; " text-index "
text-index ; text-index
" pos-line " ; " pos-line "
(buffer-pos-line buffer) ; (buffer-pos-line buffer)
" num-lines " ; " num-lines "
num-lines) ; num-lines)
; (if (and (not (zero? text-index)) ; (if (and (not (zero? text-index))
; (zero? (remainder text-index num-cols)) ; (zero? (remainder text-index num-cols))
@ -368,10 +373,10 @@
(set-buffer-pos-x! buffer (+ first-column (set-buffer-pos-x! buffer (+ first-column
(modulo text-index num-cols))) (modulo text-index num-cols)))
(debug-message "cursor position " ; (debug-message "cursor position "
(buffer-pos-x buffer) ; (buffer-pos-x buffer)
" " ; " "
(buffer-pos-y buffer)) ; (buffer-pos-y buffer))
; (debug-message "num-cols " num-cols ; (debug-message "num-cols " num-cols
; " pos-col " pos-col ; " pos-col " pos-col
; " text '" (buffer-text-current-line buffer) "'") ; " text '" (buffer-text-current-line buffer) "'")

View File

@ -361,6 +361,8 @@
buffer-history-pos buffer-history-pos
set-buffer-history-pos! set-buffer-history-pos!
make-buffer make-buffer
buffer-text-current-line
buffer-text-append-new-line!
input input
print-command-buffer print-command-buffer
cursor-right-pos cursor-right-pos