Documentation
¶
Index ¶
- type Editor
- func (e *Editor) ClearDirty()
- func (e *Editor) ClearHighlights()
- func (e *Editor) ClearHistory()
- func (e *Editor) ClearSelection()
- func (e *Editor) CutSelection() (bool, error)
- func (e *Editor) DeleteBackward() error
- func (e *Editor) DeleteForward() error
- func (e *Editor) End()
- func (e *Editor) FilePath() string
- func (e *Editor) Find(term string, startPos types.Position, forward bool) (types.Position, bool)
- func (e *Editor) GetBuffer() buffer.Buffer
- func (e *Editor) GetBufferCol(lineIdx int, visualCol int) int
- func (e *Editor) GetCurrentSearchHighlights() []types.HighlightRegion
- func (e *Editor) GetCurrentTree() *sitter.Tree
- func (e *Editor) GetCursor() types.Position
- func (e *Editor) GetEventManager() *event.Manager
- func (e *Editor) GetFindManager() *find.Manager
- func (e *Editor) GetHighlightManager() *highlight.Manager
- func (e *Editor) GetHistoryManager() *history.Manager
- func (e *Editor) GetSelecting() bool
- func (e *Editor) GetSelection() (start types.Position, end types.Position, ok bool)
- func (e *Editor) GetSyntaxHighlightsForLine(lineNum int) []types.StyledRange
- func (e *Editor) GetViewport() (int, int)
- func (e *Editor) GetVisualSelectionLines() (startLine, endLine int)
- func (e *Editor) HardHome()
- func (e *Editor) HasHighlights() bool
- func (e *Editor) HasSelection() bool
- func (e *Editor) HighlightMatches(term string) error
- func (e *Editor) Home()
- func (e *Editor) InsertNewLine() error
- func (e *Editor) InsertRune(r rune) error
- func (e *Editor) InsertTab() error
- func (e *Editor) IsDirty(line int) bool
- func (e *Editor) IsLinewise() bool
- func (e *Editor) MarkAllDirty()
- func (e *Editor) MarkDirty(line int)
- func (e *Editor) MoveCursor(deltaLine, deltaCol int)
- func (e *Editor) NeedsFullRedraw() bool
- func (e *Editor) PageMove(deltaPages int)
- func (e *Editor) Paste(after bool) (bool, error)
- func (e *Editor) Redo() (bool, error)
- func (e *Editor) Replace(pattern, replacement string, global bool) (int, error)
- func (e *Editor) ReplaceAll(pattern, replacement string) (int, error)
- func (e *Editor) ReplaceInRange(pattern, replacement string, startLine, endLine int) (int, error)
- func (e *Editor) SaveBuffer(filePath ...string) error
- func (e *Editor) ScrollOff() int
- func (e *Editor) ScrollToCursor()
- func (e *Editor) SetCursor(pos types.Position)
- func (e *Editor) SetEventManager(mgr *event.Manager)
- func (e *Editor) SetHighlighter(h *hl.Highlighter)
- func (e *Editor) SetLinewise(lw bool)
- func (e *Editor) SetViewSize(width, height int)
- func (e *Editor) StartOrUpdateSelection()
- func (e *Editor) Undo() (bool, error)
- func (e *Editor) UpdateSyntaxHighlights(newHighlights hl.HighlightResult, newTree *sitter.Tree)
- func (e *Editor) WordBackward()
- func (e *Editor) WordEnd()
- func (e *Editor) WordForward()
- func (e *Editor) YankSelection() (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Editor ¶
type Editor struct {
// contains filtered or unexported fields
}
Editor coordinates all editing operations
func NewEditor ¶
func NewEditor(buf buffer.Buffer, highlighterService *hl.Highlighter, eventManager *event.Manager) *Editor
NewEditor creates a new Editor instance with a given buffer. eventManager is used by the highlight manager to dispatch TypeHighlightComplete when a background highlighting pass completes; pass nil to disable.
func (*Editor) ClearDirty ¶ added in v0.1.3
func (e *Editor) ClearDirty()
ClearDirty resets all dirty-line tracking state after a frame has been drawn.
func (*Editor) ClearHighlights ¶
func (e *Editor) ClearHighlights()
ClearHighlights clears search highlights.
func (*Editor) ClearHistory ¶
func (e *Editor) ClearHistory()
ClearHistory clears the undo/redo stack
func (*Editor) ClearSelection ¶
func (e *Editor) ClearSelection()
ClearSelection resets the selection state.
func (*Editor) CutSelection ¶ added in v0.1.3
func (*Editor) DeleteBackward ¶
func (*Editor) DeleteForward ¶
func (*Editor) FilePath ¶ added in v0.1.1
FilePath returns the file path from the buffer. Required by highlight manager.
func (*Editor) GetBufferCol ¶ added in v0.1.3
func (*Editor) GetCurrentSearchHighlights ¶
func (e *Editor) GetCurrentSearchHighlights() []types.HighlightRegion
GetCurrentSearchHighlights delegates to findManager
func (*Editor) GetCurrentTree ¶
GetCurrentTree safely gets the current tree from the highlight manager
func (*Editor) GetEventManager ¶
GetEventManager returns the event manager
func (*Editor) GetFindManager ¶
GetFindManager provides direct access to the find manager
func (*Editor) GetHighlightManager ¶ added in v0.1.1
GetHighlightManager returns the highlight manager instance. Needed for App to call AccumulateEdit.
func (*Editor) GetHistoryManager ¶
GetHistoryManager returns the history manager for undo/redo
func (*Editor) GetSelecting ¶
GetSelecting returns whether selection is active
func (*Editor) GetSelection ¶
GetSelection returns the normalized selection range (start <= end).
func (*Editor) GetSyntaxHighlightsForLine ¶
func (e *Editor) GetSyntaxHighlightsForLine(lineNum int) []types.StyledRange
GetSyntaxHighlightsForLine returns highlights for a specific line from the manager.
func (*Editor) GetViewport ¶
GetViewport returns the viewport position by delegating to the cursor manager
func (*Editor) GetVisualSelectionLines ¶ added in v0.1.3
GetVisualSelectionLines returns the start and end line numbers of the current visual selection. If no selection is active it returns the cursor line for both.
func (*Editor) HardHome ¶ added in v0.1.3
func (e *Editor) HardHome()
HardHome moves the cursor to column 0 (Vim '0' behaviour).
func (*Editor) HasHighlights ¶
HasHighlights checks for search highlights.
func (*Editor) HasSelection ¶
HasSelection returns whether there's an active selection
func (*Editor) HighlightMatches ¶
func (*Editor) InsertNewLine ¶
func (*Editor) InsertRune ¶
Text operation methods delegated to textOps
func (*Editor) IsDirty ¶ added in v0.1.3
IsDirty reports whether the given buffer line needs to be redrawn. Returns true also when a full redraw has been requested.
func (*Editor) IsLinewise ¶ added in v0.1.3
IsLinewise returns true if the current selection is line-wise.
func (*Editor) MarkAllDirty ¶ added in v0.1.3
func (e *Editor) MarkAllDirty()
MarkAllDirty signals that every visible line must be redrawn. This is used on viewport scroll, theme change, search highlight update, etc.
func (*Editor) MarkDirty ¶ added in v0.1.3
MarkDirty marks a specific buffer line as needing a redraw.
func (*Editor) MoveCursor ¶
Cursor operations delegated to cursorManager
func (*Editor) NeedsFullRedraw ¶ added in v0.1.3
NeedsFullRedraw reports whether the entire viewport should be cleared and redrawn.
func (*Editor) ReplaceAll ¶ added in v0.1.3
ReplaceAll replaces all occurrences of pattern across the entire buffer. Wraps the operation in a history transaction for atomic undo.
func (*Editor) ReplaceInRange ¶ added in v0.1.3
ReplaceInRange replaces all occurrences of pattern in [startLine, endLine]. Wraps the operation in a history transaction for atomic undo.
func (*Editor) SaveBuffer ¶
SaveBuffer handles buffer saving, accepting an optional override path.
func (*Editor) ScrollToCursor ¶
func (e *Editor) ScrollToCursor()
ScrollToCursor ensures cursor remains visible
func (*Editor) SetEventManager ¶
SetEventManager sets the event manager for dispatching events
func (*Editor) SetHighlighter ¶
func (e *Editor) SetHighlighter(h *hl.Highlighter)
SetHighlighter (optional) allows changing the highlighter service later if needed.
func (*Editor) SetLinewise ¶ added in v0.1.3
SetLinewise marks the current selection as line-wise (Vim 'V' behaviour).
func (*Editor) SetViewSize ¶
SetViewSize updates the view dimensions
func (*Editor) StartOrUpdateSelection ¶
func (e *Editor) StartOrUpdateSelection()
StartOrUpdateSelection manages selection state during movement.
func (*Editor) UpdateSyntaxHighlights ¶
func (e *Editor) UpdateSyntaxHighlights(newHighlights hl.HighlightResult, newTree *sitter.Tree)
UpdateSyntaxHighlights tells the highlight manager to update its internal state. This might be called by the highlight manager's background task.
func (*Editor) WordBackward ¶ added in v0.1.3
func (e *Editor) WordBackward()
WordBackward moves the cursor to the start of the current/previous word (Vim 'b').
func (*Editor) WordEnd ¶ added in v0.1.3
func (e *Editor) WordEnd()
WordEnd moves the cursor to the end of the current/next word (Vim 'e').
func (*Editor) WordForward ¶ added in v0.1.3
func (e *Editor) WordForward()
WordForward moves the cursor to the start of the next word (Vim 'w').
func (*Editor) YankSelection ¶
Clipboard operations delegated to clipboardManager