line

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IDGenerator

type IDGenerator interface {
	Next() uint64
}

IDGenerator defines an interface for things that generate unique IDs for lines used within peco.

type Line

type Line interface {
	btree.Item

	ID() uint64

	// Buffer returns the raw buffer
	Buffer() string

	// DisplayString returns the string to be displayed. This means if you have
	// a null separator, the contents after the separator are not included
	// in this string
	DisplayString() string

	// Output returns the string to be display as peco finishes up doing its
	// thing. This means if you have null separator, the contents before the
	// separator are not included in this string
	Output() string

	// IsDirty returns true if this line should be forcefully redrawn
	IsDirty() bool

	// SetDirty sets the dirty flag on or off
	SetDirty(bool)
}

Line represents each of the line that peco uses to display and match against queries.

type Matched

type Matched struct {
	Line
	// contains filtered or unexported fields
}

Matched contains the indices to the matches

func NewMatched

func NewMatched(rl Line, matches [][]int) *Matched

NewMatched creates a new Matched

func (Matched) Indices

func (ml Matched) Indices() [][]int

Indices returns the indices in the buffer that matched

type Raw

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

Raw is the input line as sent to peco, before filtering and what not.

func NewRaw

func NewRaw(id uint64, v string, enableSep bool) *Raw

NewRaw creates a new Raw. The `enableSep` flag tells it if we should search for a null character to split the string to display and the string to emit upon selection of of said line

func (Raw) Buffer

func (rl Raw) Buffer() string

Buffer returns the raw buffer. May contain null

func (Raw) DisplayString

func (rl Raw) DisplayString() string

DisplayString returns the string to be displayed

func (*Raw) ID

func (rl *Raw) ID() uint64

ID returns the unique ID of this line

func (Raw) IsDirty

func (rl Raw) IsDirty() bool

IsDirty returns true if this line must be redrawn on the terminal

func (*Raw) Less

func (rl *Raw) Less(b btree.Item) bool

Less implements the btree.Item interface

func (Raw) Output

func (rl Raw) Output() string

Output returns the string to be displayed *after peco is done

func (*Raw) SetDirty

func (rl *Raw) SetDirty(b bool)

SetDirty sets the dirty flag

Jump to

Keyboard shortcuts

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