Documentation
¶
Overview ¶
Package text provides the Unicode-aware gap buffer used by Kite's text controls for editing and caret movement.
Index ¶
- type Buffer
- func (b *Buffer) Backspace(graphemeCount int)
- func (b *Buffer) ByteLen() int
- func (b *Buffer) ByteOffset() int
- func (b *Buffer) Chunks() ([]rune, []rune)
- func (b *Buffer) Delete(graphemeCount int)
- func (b *Buffer) DeleteNext()
- func (b *Buffer) DeletePrevious()
- func (b *Buffer) DeleteRange(start, end int)
- func (b *Buffer) DeleteWordNext()
- func (b *Buffer) DeleteWordPrevious()
- func (b *Buffer) Insert(text string)
- func (b *Buffer) Len() int
- func (b *Buffer) MoveEnd()
- func (b *Buffer) MoveLeft()
- func (b *Buffer) MoveRight()
- func (b *Buffer) MoveStart()
- func (b *Buffer) MoveToEnd()
- func (b *Buffer) MoveToStart()
- func (b *Buffer) MoveWordLeft()
- func (b *Buffer) MoveWordRight()
- func (b *Buffer) Reset(text string)
- func (b *Buffer) SetByteOffset(offset int)
- func (b *Buffer) SetOffset(offset int)
- func (b *Buffer) Value() string
- func (b *Buffer) Version() int64
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 manages 1-dimensional string edits with Unicode safety using a gap buffer.
func (*Buffer) Backspace ¶
Backspace removes the specified number of grapheme clusters before the gap.
func (*Buffer) ByteOffset ¶
ByteOffset returns the current gap (cursor) position as a byte offset.
func (*Buffer) DeleteNext ¶
func (b *Buffer) DeleteNext()
DeleteNext is an alias for Delete(1) for compatibility.
func (*Buffer) DeletePrevious ¶
func (b *Buffer) DeletePrevious()
DeletePrevious is an alias for Backspace(1) for compatibility.
func (*Buffer) DeleteRange ¶
DeleteRange removes the text between the start and end byte offsets.
func (*Buffer) DeleteWordNext ¶
func (b *Buffer) DeleteWordNext()
DeleteWordNext removes the word after the gap.
func (*Buffer) DeleteWordPrevious ¶
func (b *Buffer) DeleteWordPrevious()
DeleteWordPrevious removes the word before the gap.
func (*Buffer) MoveLeft ¶
func (b *Buffer) MoveLeft()
MoveLeft moves the gap one grapheme cluster to the left.
func (*Buffer) MoveRight ¶
func (b *Buffer) MoveRight()
MoveRight moves the gap one grapheme cluster to the right.
func (*Buffer) MoveStart ¶
func (b *Buffer) MoveStart()
MoveStart moves the gap to the beginning of the buffer.
func (*Buffer) MoveToEnd ¶
func (b *Buffer) MoveToEnd()
MoveToEnd is an alias for MoveEnd for compatibility.
func (*Buffer) MoveToStart ¶
func (b *Buffer) MoveToStart()
MoveToStart is an alias for MoveStart for compatibility.
func (*Buffer) MoveWordLeft ¶
func (b *Buffer) MoveWordLeft()
MoveWordLeft moves the gap to the start of the previous word.
func (*Buffer) MoveWordRight ¶
func (b *Buffer) MoveWordRight()
MoveWordRight moves the gap to the end of the next word.
func (*Buffer) Reset ¶
Reset replaces the entire buffer content with the given text and moves the cursor to the end.
func (*Buffer) SetByteOffset ¶
SetByteOffset moves the gap to the specified byte offset.