diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/buffer.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/editor/buffer.go b/editor/buffer.go index 54ac23e..503cf02 100644 --- a/editor/buffer.go +++ b/editor/buffer.go @@ -246,6 +246,14 @@ func (b *Buffer) Delete() (int, error) { return n, nil } +// Destroy will mark the buffer as completely empty and reset to 0. +func (b *Buffer) Destroy() { + b.buf.Destroy() + b.SetDot(0, 0) + b.dirty = false + b.file.read = false +} + // Len returns the number of bytes in buffer. func (b *Buffer) Len() int { b.initBuffer() |