edward

An extensible POSIX-compatible implementation of the ed(1) text editor

git clone https://git.8pit.net/edward.git

 1;;> A text buffer for line-based data with [undo support][undo section].
 2;;> Operations on the buffer address lines, the first line starts at
 3;;> index 1. The special index 0 can be used with the [append command][append command]
 4;;> to insert text before the first line. For other commands, index 0 is
 5;;> equivalent to index 1. Targeting a line outside the current buffer
 6;;> bounds causes an error to be raised.
 7;;>
 8;;> [undo section]: #section-undo-stack
 9;;> [append command]: #buffer-append!
10
11(define-library (edward.buffer)
12  (import (scheme base)
13          (scheme case-lambda)
14
15          (srfi 1)
16
17          (only (chicken base) vector-resize)
18
19          (edward util))
20
21  (export make-buffer buffer->list buffer-length buffer-empty? buffer-ref
22          buffer-append! buffer-remove! buffer-with-undo buffer-has-undo?
23          buffer-undo! buffer-replace! buffer-join! buffer-move!)
24
25  (include "buffer/stack.scm"
26           "buffer/srfi214-minimal.scm"
27           "buffer/buffer.scm"))