Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InsertNode ¶
func InsertNode(src *BufferNode, n *BufferNode)
InsertNode inserts node `n` before node `src`
func ReplaceNode ¶
func ReplaceNode(old *BufferNode, new *BufferNode)
ReplaceNode replaces node `old` with `new` in the Linked List
Types ¶
type Buffer ¶
type Buffer struct { Path string // Absolute path on disk. Val *gapbuffer.GapBuffer[rune] // Actual raw text data. Gap Buffer is a nice compromise between Piece Chain and buffer. Lines *gapbuffer.GapBuffer[int] // The line numbers are also stored in a Gap Buffer CursorRow, CursorCol int // ??? Cursor cursor.Model // Cursor position inside this buffer. // contains filtered or unexported fields }
Buffer represents an opened file.
func NewBuffer ¶
NewBuffer constructs a new buffer from a path. If that file exists, it opens it for reading, otherwise it will just open a fake file in memory
func (*Buffer) CursorLeft ¶
func (b *Buffer) CursorLeft()
func (*Buffer) CursorRight ¶
func (b *Buffer) CursorRight()
CursorRight moves the cursor one position to the right
type BufferNode ¶
type BufferNode struct { Prev *BufferNode Next *BufferNode Buffer *Buffer }
The bufferline is composed of a linked-list
type LinkedList ¶
type LinkedList struct {
// contains filtered or unexported fields
}
func NewList ¶
func NewList() LinkedList
func (*LinkedList) AddNode ¶
func (l *LinkedList) AddNode(n *BufferNode)
func (*LinkedList) Iter ¶
func (l *LinkedList) Iter() common.Iterator[BufferNode]
Creates an iterator over the LinkedList elements
type NodeIterator ¶
type NodeIterator struct {
// contains filtered or unexported fields
}
NodeIterator implements the Iterator interface for LinkedList
func (*NodeIterator) HasNext ¶
func (i *NodeIterator) HasNext() bool
HasNext tells us wether the iterator still has elements to consume
func (*NodeIterator) Next ¶
func (i *NodeIterator) Next() *BufferNode
Next gets the next element in this iterator
Click to show internal directories.
Click to hide internal directories.