core

package
v0.1.0-next Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

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) *Editor

NewEditor creates a new Editor instance with a given buffer.

func (*Editor) ClearHighlights

func (e *Editor) ClearHighlights()

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) DeleteBackward

func (e *Editor) DeleteBackward() error

func (*Editor) DeleteForward

func (e *Editor) DeleteForward() error

func (*Editor) End

func (e *Editor) End()

func (*Editor) Find

func (e *Editor) Find(term string, startPos types.Position, forward bool) (types.Position, bool)

Find operations delegated to findManager

func (*Editor) GetBuffer

func (e *Editor) GetBuffer() buffer.Buffer

GetBuffer returns the editor's buffer.

func (*Editor) GetCurrentSearchHighlights

func (e *Editor) GetCurrentSearchHighlights() []types.HighlightRegion

GetCurrentSearchHighlights delegates to findManager

func (*Editor) GetCurrentTree

func (e *Editor) GetCurrentTree() *sitter.Tree

GetCurrentTree safely gets the current tree (needed for incremental parse)

func (*Editor) GetCursor

func (e *Editor) GetCursor() types.Position

GetCursor returns the current cursor position.

func (*Editor) GetEventManager

func (e *Editor) GetEventManager() *event.Manager

GetEventManager returns the event manager

func (*Editor) GetFindManager

func (e *Editor) GetFindManager() *find.Manager

GetFindManager provides direct access to the find manager

func (*Editor) GetHighlights

func (e *Editor) GetHighlights() []types.HighlightRegion

func (*Editor) GetHistoryManager

func (e *Editor) GetHistoryManager() *history.Manager

GetHistoryManager returns the history manager for undo/redo

func (*Editor) GetSelecting

func (e *Editor) GetSelecting() bool

GetSelecting returns whether selection is active

func (*Editor) GetSelection

func (e *Editor) GetSelection() (start types.Position, end types.Position, ok bool)

GetSelection returns the normalized selection range (start <= end). Returns two invalid positions and false if no selection is active.

func (*Editor) GetSyntaxHighlightsForLine

func (e *Editor) GetSyntaxHighlightsForLine(lineNum int) []types.StyledRange

GetSyntaxHighlightsForLine returns highlights for a specific line

func (*Editor) GetViewport

func (e *Editor) GetViewport() (int, int)

GetViewport returns the viewport position by delegating to the cursor manager

func (*Editor) HasHighlights

func (e *Editor) HasHighlights() bool

func (*Editor) HasSelection

func (e *Editor) HasSelection() bool

HasSelection returns whether there's an active selection

func (*Editor) HighlightMatches

func (e *Editor) HighlightMatches(term string) error

func (*Editor) Home

func (e *Editor) Home()

func (*Editor) InsertNewLine

func (e *Editor) InsertNewLine() error

func (*Editor) InsertRune

func (e *Editor) InsertRune(r rune) error

Text operation methods delegated to textOps

func (*Editor) InsertTab

func (e *Editor) InsertTab() error

func (*Editor) MoveCursor

func (e *Editor) MoveCursor(deltaLine, deltaCol int)

Cursor operations delegated to cursorManager

func (*Editor) PageMove

func (e *Editor) PageMove(deltaPages int)

func (*Editor) Paste

func (e *Editor) Paste() (bool, error)

func (*Editor) Redo

func (e *Editor) Redo() (bool, error)

Redo reapplies a previously undone change

func (*Editor) Replace

func (e *Editor) Replace(pattern, replacement string, global bool) (int, error)

Replace performs a find and replace operation using findManager

func (*Editor) SaveBuffer

func (e *Editor) SaveBuffer(filePath ...string) error

SaveBuffer handles buffer saving, accepting an optional override path.

func (*Editor) ScrollOff

func (e *Editor) ScrollOff() int

ScrollOff returns the scrolloff setting (lines to keep visible above/below cursor)

func (*Editor) ScrollToCursor

func (e *Editor) ScrollToCursor()

ScrollToCursor ensures cursor remains visible

func (*Editor) SetCursor

func (e *Editor) SetCursor(pos types.Position)

SetCursor sets the cursor position

func (*Editor) SetEventManager

func (e *Editor) SetEventManager(mgr *event.Manager)

SetEventManager sets the event manager for dispatching events

func (*Editor) SetHighlighter

func (e *Editor) SetHighlighter(h *hl.Highlighter)

SetHighlighter injects the highlighter service.

func (*Editor) SetViewSize

func (e *Editor) SetViewSize(width, height int)

SetViewSize updates the view dimensions

func (*Editor) StartOrUpdateSelection

func (e *Editor) StartOrUpdateSelection()

StartOrUpdateSelection manages selection state during movement. Called typically when a Shift + movement key is pressed.

func (*Editor) TriggerSyntaxHighlight

func (e *Editor) TriggerSyntaxHighlight()

TriggerSyntaxHighlight triggers a highlight operation

func (*Editor) Undo

func (e *Editor) Undo() (bool, error)

Undo reverts the last text change

func (*Editor) UpdateSyntaxHighlights

func (e *Editor) UpdateSyntaxHighlights(newHighlights hl.HighlightResult, newTree *sitter.Tree)

UpdateSyntaxHighlights updates the highlighting

func (*Editor) YankSelection

func (e *Editor) YankSelection() (bool, error)

Clipboard operations delegated to clipboardManager

Directories

Path Synopsis
Package history provides undo/redo functionality via a change history stack.
Package history provides undo/redo functionality via a change history stack.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL