Skip to content

Commit

Permalink
buffer: Allow position arguments to be passed to buffer->list
Browse files Browse the repository at this point in the history
  • Loading branch information
nmeum committed Aug 10, 2024
1 parent ea25fcc commit 2483e32
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/buffer/buffer.scm
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@
(define (make-buffer)
(%make-buffer (flexvector) #f (make-stack)))

;;> Convert the line buffer to a list of lines.
;;> Convert the line buffer to a list of lines. Additionally, this
;;> procedure accepts an optional `start` and `end` parameter. If
;;> these parameters are given the list only contains the elements
;;> between `start` and `end`. By default the whole buffer is converted.

(define (buffer->list buffer)
(flexvector->list (buffer-lines buffer)))
(define (buffer->list buffer . o)
(apply flexvector->list (buffer-lines buffer) o))

;;> Length of the buffer, i.e. amount of lines currently stored in it.

Expand Down

0 comments on commit 2483e32

Please sign in to comment.