Documentation
¶
Overview ¶
Package buffer provides Cove's text buffer: a rope of bytes plus a line-start index, giving O(lg n) edits and O(1) line addressing. The rope implementation is swappable; nothing outside this package touches it directly.
Index ¶
- type Buffer
- func (b *Buffer) Bytes() []byte
- func (b *Buffer) Delete(start, end int)
- func (b *Buffer) Insert(off int, text []byte)
- func (b *Buffer) Len() int
- func (b *Buffer) Line(i int) []byte
- func (b *Buffer) LineCount() int
- func (b *Buffer) LineLen(i int) int
- func (b *Buffer) Offset(line, col int) int
- func (b *Buffer) Pos(off int) (line, col int)
- func (b *Buffer) Slice(start, end int) []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer is a mutable text buffer addressed by byte offset or (line, col). Lines and columns are 0-based; col is a byte offset within the line.
func (*Buffer) Line ¶
Line returns the content of line i without its trailing newline. The returned slice is only valid until the next edit.
Click to show internal directories.
Click to hide internal directories.