find

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseSubstituteCommand

func ParseSubstituteCommand(cmdStr string) (pattern, replacement string, global bool, err error)

ParseSubstituteCommand parses the :s/pattern/replacement/[g] command string.

Types

type EditorInterface

type EditorInterface interface {
	GetBuffer() buffer.Buffer
	GetCursor() types.Position
	SetCursor(types.Position)
	GetEventManager() *event.Manager
	ScrollToCursor()
	GetHistoryManager() *history.Manager
}

EditorInterface defines methods the find manager needs from the editor.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager handles find, replace, and search highlighting logic.

func NewManager

func NewManager(editor EditorInterface) *Manager

NewManager creates a find manager.

func (*Manager) ClearHighlights

func (m *Manager) ClearHighlights()

ClearHighlights removes search highlight regions.

func (*Manager) FindNext

func (m *Manager) FindNext(forward bool) (types.Position, bool, bool)

FindNext finds the next occurrence and moves cursor to it. Now returns wrapped status as the third return value.

func (*Manager) GetHighlights

func (m *Manager) GetHighlights() []types.HighlightRegion

GetHighlights returns the current search highlight regions.

func (*Manager) HasHighlights

func (m *Manager) HasHighlights() bool

HasHighlights checks if there are any search highlights.

func (*Manager) HighlightMatches

func (m *Manager) HighlightMatches(term string) error

HighlightMatches finds and stores all occurrences for highlighting.

func (*Manager) Replace

func (m *Manager) Replace(patternStr, replacement string, global bool) (int, error)

Replace replaces occurrences on the current line. Supports global 'g' flag. Undo support is NOT implemented for this operation yet.

Jump to

Keyboard shortcuts

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