search

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2024 License: MIT Imports: 9 Imported by: 0

README

Package search is a high-performance search algorithm to find matches for a regex pattern on the terminal screen over the course of a recorded terminal session. This is more complicated than it seems: it must track the exact byte at which a match first appeared and calculate how long that match remained intact on the screen.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSearcher added in v0.1.6

func NewSearcher() *searcher

Types

type Address

type Address struct {
	// The index of the event
	Index int
	// The byte offset at which (after parsing) the match either appeared
	// or disappeared
	Offset int
}

Address refers to a point inside of a recording.

func (Address) After added in v0.1.5

func (a Address) After(other Address) bool

func (Address) Before added in v0.1.5

func (a Address) Before(other Address) bool

func (Address) Equal added in v0.1.5

func (a Address) Equal(other Address) bool

type Appearance added in v0.1.6

type Appearance struct {
	Selection
	Begin, End Address
}

type Match added in v0.1.6

type Match struct {
	Begin, End Address
	// Whether this Match is unbroken by nonprintable characters. If this
	// is true, it is definitely a match.
	Continuous bool
}

type SearchResult

type SearchResult struct {
	// The location of the result in time
	Begin, End Address
	// The location of the result on the screen
	Appearances []Appearance
}
func Search(events []sessions.Event, pattern string, progress chan<- int) (results []SearchResult, err error)

type Selection added in v0.1.6

type Selection struct {
	From, To geom.Vec2
}

func (Selection) Within added in v0.1.6

func (s Selection) Within(pos geom.Vec2, size geom.Vec2) bool

Within returns true if `pos` falls within the Selection.

func (Selection) WithinRect added in v0.1.6

func (s Selection) WithinRect(rect geom.Rect, size geom.Vec2) bool

Jump to

Keyboard shortcuts

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