Documentation ¶
Index ¶
- Constants
- Variables
- func IsValidLayoutType(v LayoutType) bool
- func IsValidVerticalAnchor(anchor VerticalAnchor) bool
- func LocateRcfile(locater configLocateFunc) (string, error)
- type Action
- type ActionFunc
- type ActionMap
- type AnchorSettings
- type BasicLayout
- type Buffer
- type CLI
- type CLIOptions
- type Caret
- type CommandConfig
- type Config
- type CustomFilterConfig
- type ExternalCmdFilter
- type Filter
- type FilterQuery
- type FilterSet
- type FilteredBuffer
- type Input
- type Inputseq
- type JumpToLineRequest
- type Keymap
- type Keyseq
- type Layout
- type LayoutType
- type Line
- type LineFilter
- type ListArea
- type Location
- func (l Location) Column() int
- func (l Location) LineNumber() int
- func (l Location) MaxPage() int
- func (l Location) Offset() int
- func (l Location) Page() int
- func (l Location) PageCrop() PageCrop
- func (l Location) PerPage() int
- func (l *Location) SetColumn(n int)
- func (l *Location) SetLineNumber(n int)
- func (l *Location) SetMaxPage(n int)
- func (l *Location) SetOffset(n int)
- func (l *Location) SetPage(n int)
- func (l *Location) SetPerPage(n int)
- func (l *Location) SetTotal(n int)
- func (l Location) Total() int
- type MatchedLine
- type MemoryBuffer
- func (mb *MemoryBuffer) Accept(ctx context.Context, in chan interface{}, _ pipeline.OutputChannel)
- func (mb *MemoryBuffer) Append(l Line)
- func (mb *MemoryBuffer) Done() <-chan struct{}
- func (mb *MemoryBuffer) LineAt(n int) (Line, error)
- func (mb *MemoryBuffer) Reset()
- func (mb *MemoryBuffer) Size() int
- type PageCrop
- type PagingRequest
- type PagingRequestType
- type Peco
- func (p *Peco) ApplyConfig(opts CLIOptions) error
- func (p *Peco) Caret() *Caret
- func (p *Peco) CollectResults()
- func (p *Peco) CurrentLineBuffer() Buffer
- func (p *Peco) Err() error
- func (p *Peco) ExecQuery() bool
- func (p *Peco) Exit(err error)
- func (p *Peco) Filters() *FilterSet
- func (p *Peco) Hub() *hub.Hub
- func (p *Peco) Inputseq() *Inputseq
- func (p *Peco) Keymap() Keymap
- func (p *Peco) LayoutType() string
- func (p *Peco) Location() *Location
- func (p *Peco) Prompt() string
- func (p *Peco) Query() *Query
- func (p *Peco) QueryExecDelay() time.Duration
- func (p *Peco) Ready() <-chan struct{}
- func (p *Peco) ResetCurrentLineBuffer()
- func (p *Peco) ResultCh() chan Line
- func (p *Peco) Run(ctx context.Context) (err error)
- func (p *Peco) Screen() Screen
- func (p *Peco) Selection() *Selection
- func (p *Peco) SelectionRangeStart() *RangeStart
- func (p *Peco) SetCurrentLineBuffer(b Buffer)
- func (p *Peco) SetResultCh(ch chan Line)
- func (p *Peco) SetSingleKeyJumpMode(b bool)
- func (p *Peco) Setup() (err error)
- func (p *Peco) SetupSource() (s *Source, err error)
- func (p *Peco) SingleKeyJumpIndex(ch rune) (uint, bool)
- func (p *Peco) SingleKeyJumpMode() bool
- func (p *Peco) SingleKeyJumpPrefixes() []rune
- func (p *Peco) SingleKeyJumpShowPrefix() bool
- func (p *Peco) Source() pipeline.Source
- func (p *Peco) Styles() *StyleSet
- func (p *Peco) ToggleSingleKeyJumpMode()
- type PrintArgs
- type Query
- func (q *Query) Append(r rune)
- func (q *Query) DeleteRange(start, end int)
- func (q *Query) InsertAt(ch rune, where int)
- func (q *Query) Len() int
- func (q *Query) Reset()
- func (q *Query) RestoreSavedQuery()
- func (q *Query) RuneAt(where int) rune
- func (q *Query) Runes() <-chan rune
- func (q *Query) SaveQuery()
- func (q *Query) Set(s string)
- func (q *Query) String() string
- type RangeStart
- type RawLine
- type RegexpFilter
- type Screen
- type Selection
- type SingleKeyJumpConfig
- type Source
- func (s *Source) Append(l Line)
- func (s *Source) LineAt(n int) (Line, error)
- func (s *Source) Ready() <-chan struct{}
- func (s *Source) Reset()
- func (s *Source) Setup(state *Peco)
- func (s *Source) SetupDone() <-chan struct{}
- func (s *Source) Size() int
- func (s *Source) Start(ctx context.Context, out pipeline.OutputChannel)
- type State
- type StatusBar
- type StatusMsgRequest
- type Style
- type StyleSet
- type Termbox
- func (t *Termbox) Close() error
- func (t *Termbox) Flush() error
- func (t *Termbox) Init() error
- func (t *Termbox) PollEvent() chan termbox.Event
- func (t *Termbox) PostInit() error
- func (t *Termbox) Print(args PrintArgs) int
- func (t *Termbox) SendEvent(_ termbox.Event)
- func (t *Termbox) SetCell(x, y int, ch rune, fg, bg termbox.Attribute)
- func (t *Termbox) Size() (int, int)
- type UserPrompt
- type VerticalAnchor
- type View
Constants ¶
const ( DefaultLayoutType = LayoutTypeTopDown // LayoutTypeTopDown makes the layout so the items read from top to bottom LayoutTypeTopDown = "top-down" // LayoutTypeBottomUp changes the layout to read from bottom to up LayoutTypeBottomUp = "bottom-up" )
const ( IgnoreCaseMatch = "IgnoreCase" CaseSensitiveMatch = "CaseSensitive" SmartCaseMatch = "SmartCase" RegexpMatch = "Regexp" )
These are used as keys in the config file
const DefaultCustomFilterBufferThreshold = 100
DefaultCustomFilterBufferThreshold is the default value for BufferThreshold setting on CustomFilters.
Variables ¶
var ErrFilterNotFound = errors.New("specified filter was not found")
Functions ¶
func IsValidLayoutType ¶ added in v0.2.5
func IsValidLayoutType(v LayoutType) bool
IsValidLayoutType checks if a string is a supported layout type
func IsValidVerticalAnchor ¶ added in v0.2.6
func IsValidVerticalAnchor(anchor VerticalAnchor) bool
IsValidVerticalAnchor checks if the specified anchor is supported
func LocateRcfile ¶ added in v0.1.3
LocateRcfile attempts to find the config file in various locations
Types ¶
type Action ¶ added in v0.2.0
type Action interface { Register(string, ...termbox.Key) RegisterKeySequence(string, keyseq.KeyList) Execute(context.Context, *Peco, termbox.Event) }
Action describes an action that can be executed upon receiving user input. It's an interface so you can create any kind of Action you need, but most everything is implemented in terms of ActionFunc, which is callback based Action
type ActionFunc ¶ added in v0.2.0
ActionFunc is a type of Action that is basically just a callback.
func (ActionFunc) Execute ¶ added in v0.2.0
func (a ActionFunc) Execute(ctx context.Context, state *Peco, e termbox.Event)
Execute fulfills the Action interface for AfterFunc
func (ActionFunc) Register ¶ added in v0.2.0
func (a ActionFunc) Register(name string, defaultKeys ...termbox.Key)
Register fulfills the Action interface for AfterFunc. Registers `a` into the global action registry by the name `name`, and maps to default keys via `defaultKeys`
func (ActionFunc) RegisterKeySequence ¶ added in v0.2.0
func (a ActionFunc) RegisterKeySequence(name string, k keyseq.KeyList)
RegisterKeySequence satisfies the Action interface for AfterFunc. Registers the action to be mapped against a key sequence
type AnchorSettings ¶ added in v0.2.5
type AnchorSettings struct {
// contains filtered or unexported fields
}
AnchorSettings groups items that are required to control where an anchored item is actually placed
func NewAnchorSettings ¶ added in v0.2.6
func NewAnchorSettings(screen Screen, anchor VerticalAnchor, offset int) *AnchorSettings
NewAnchorSettings creates a new AnchorSetting struct. Panics if an unknown VerticalAnchor is sent
func (AnchorSettings) AnchorPosition ¶ added in v0.2.5
func (as AnchorSettings) AnchorPosition() int
AnchorPosition returns the starting y-offset, based on the anchor type and offset
type BasicLayout ¶ added in v0.2.5
type BasicLayout struct { *StatusBar // contains filtered or unexported fields }
BasicLayout is... the basic layout :) At this point this is the only struct for layouts, which means that while the position of components may be configurable, the actual types of components that are used are set and static
func NewBottomUpLayout ¶ added in v0.2.5
func NewBottomUpLayout(state *Peco) *BasicLayout
NewBottomUpLayout creates a new Layout in bottom-up format
func NewDefaultLayout ¶ added in v0.2.5
func NewDefaultLayout(state *Peco) *BasicLayout
NewDefaultLayout creates a new Layout in the default format (top-down)
func (*BasicLayout) CalculatePage ¶ added in v0.2.5
func (l *BasicLayout) CalculatePage(state *Peco, perPage int) error
CalculatePage calculates which page we're displaying
func (*BasicLayout) DrawPrompt ¶ added in v0.2.9
func (l *BasicLayout) DrawPrompt(state *Peco)
DrawPrompt draws the prompt to the terminal
func (*BasicLayout) DrawScreen ¶ added in v0.2.5
func (l *BasicLayout) DrawScreen(state *Peco, runningQuery bool)
DrawScreen draws the entire screen
func (*BasicLayout) MovePage ¶ added in v0.2.5
func (l *BasicLayout) MovePage(state *Peco, p PagingRequest) (moved bool)
MovePage scrolls the screen
func (*BasicLayout) PurgeDisplayCache ¶ added in v0.3.4
func (l *BasicLayout) PurgeDisplayCache()
type Buffer ¶ added in v0.4.0
Buffer interface is used for containers for lines to be processed by peco.
type CLIOptions ¶ added in v0.3.0
type CLIOptions struct { OptHelp bool `short:"h" long:"help" description:"show this help message and exit"` OptTTY string `long:"tty" description:"path to the TTY (usually, the value of $TTY)"` OptQuery string `long:"query" description:"initial value for query"` OptRcfile string `long:"rcfile" description:"path to the settings file"` OptVersion bool `long:"version" description:"print the version and exit"` OptBufferSize int `long:"buffer-size" short:"b" description:"number of lines to keep in search buffer"` OptEnableNullSep bool `long:"null" description:"expect NUL (\\0) as separator for target/output"` OptInitialIndex int `long:"initial-index" description:"position of the initial index of the selection (0 base)"` OptInitialMatcher string `long:"initial-matcher" description:"specify the default matcher (deprecated)"` OptInitialFilter string `long:"initial-filter" description:"specify the default filter"` OptPrompt string `long:"prompt" description:"specify the prompt string"` OptLayout string `long:"layout" description:"layout to be used 'top-down' or 'bottom-up'. default is 'top-down'"` OptSelect1 bool `long:"select-1" description:"select first item and immediately exit if the input contains only 1 item"` }
func (CLIOptions) Validate ¶ added in v0.4.0
func (options CLIOptions) Validate() error
type CommandConfig ¶ added in v0.3.6
type Config ¶
type Config struct { Action map[string][]string `json:"Action"` // Keymap used to be directly responsible for dispatching // events against user input, but since then this has changed // into something that just records the user's config input Keymap map[string]string `json:"Keymap"` Matcher string `json:"Matcher"` // Deprecated. InitialMatcher string `json:"InitialMatcher"` // Use this instead of Matcher InitialFilter string `json:"InitialFilter"` Style StyleSet `json:"Style"` Prompt string `json:"Prompt"` Layout string `json:"Layout"` CustomMatcher map[string][]string CustomFilter map[string]CustomFilterConfig Command []CommandConfig QueryExecutionDelay int StickySelection bool // If this is true, then the prefix for single key jump mode // is displayed by default. SingleKeyJump SingleKeyJumpConfig `json:"SingleKeyJump"` }
Config holds all the data that can be configured in the external configuran file
func (*Config) ReadFilename ¶
ReadFilename reads the config from the given file, and does the appropriate processing, if any
type CustomFilterConfig ¶ added in v0.3.0
type CustomFilterConfig struct { // Cmd is the name of the command to invoke Cmd string // TODO: need to check if how we use this is correct Args []string // BufferThreshold defines how many lines peco buffers before // invoking the external command. If this value is big, we // will execute the external command fewer times, but the // results will not be generated for longer periods of time. // If this value is small, we will execute the external command // more often, but you pay the penalty of invoking that command // more times. BufferThreshold int }
CustomFilterConfig is used to specify configuration parameters to CustomFilters
type ExternalCmdFilter ¶ added in v0.3.0
type ExternalCmdFilter struct {
// contains filtered or unexported fields
}
func NewExternalCmdFilter ¶ added in v0.3.0
func (*ExternalCmdFilter) Accept ¶ added in v0.3.0
func (ecf *ExternalCmdFilter) Accept(ctx context.Context, in chan interface{}, out pipeline.OutputChannel)
func (ExternalCmdFilter) Clone ¶ added in v0.3.0
func (ecf ExternalCmdFilter) Clone() LineFilter
func (*ExternalCmdFilter) SetQuery ¶ added in v0.3.0
func (ecf *ExternalCmdFilter) SetQuery(q string)
func (ExternalCmdFilter) String ¶ added in v0.3.0
func (ecf ExternalCmdFilter) String() string
func (*ExternalCmdFilter) Verify ¶ added in v0.3.0
func (ecf *ExternalCmdFilter) Verify() error
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter is responsible for the actual "grep" part of peco
type FilterQuery ¶ added in v0.2.6
type FilterQuery Query
type FilterSet ¶ added in v0.3.0
type FilterSet struct {
// contains filtered or unexported fields
}
func (*FilterSet) Add ¶ added in v0.3.0
func (fs *FilterSet) Add(lf LineFilter) error
func (*FilterSet) Current ¶ added in v0.4.0
func (fs *FilterSet) Current() LineFilter
func (*FilterSet) SetCurrentByName ¶ added in v0.3.0
type FilteredBuffer ¶ added in v0.4.0
type FilteredBuffer struct {
// contains filtered or unexported fields
}
FilteredBuffer holds a "filtered" buffer. It holds a reference to the source buffer (note: should be immutable) and a list of indices into the source buffer
func NewFilteredBuffer ¶ added in v0.4.0
func NewFilteredBuffer(src Buffer, page, perPage int) *FilteredBuffer
func (*FilteredBuffer) Append ¶ added in v0.4.0
func (flb *FilteredBuffer) Append(l Line) (Line, error)
func (FilteredBuffer) LineAt ¶ added in v0.4.0
func (flb FilteredBuffer) LineAt(i int) (Line, error)
LineAt returns the line at index `i`. Note that the i-th element in this filtered buffer may actually correspond to a totally different line number in the source buffer.
func (FilteredBuffer) Size ¶ added in v0.4.0
func (flb FilteredBuffer) Size() int
Size returns the number of lines in the buffer
type Input ¶
type Input struct {
// contains filtered or unexported fields
}
type Inputseq ¶ added in v0.4.0
type Inputseq []string
Inputseq is a list of keys that the user typed
type JumpToLineRequest ¶ added in v0.3.4
type JumpToLineRequest int
func (JumpToLineRequest) Line ¶ added in v0.3.4
func (jlr JumpToLineRequest) Line() int
func (JumpToLineRequest) Type ¶ added in v0.3.4
func (jlr JumpToLineRequest) Type() PagingRequestType
type Keymap ¶
type Keymap struct { Config map[string]string Action map[string][]string // custom actions // contains filtered or unexported fields }
Keymap holds all the key sequence to action map
func (*Keymap) ApplyKeybinding ¶ added in v0.2.0
ApplyKeybinding applies all of the custom key bindings on top of the default key bindings
func (Keymap) ExecuteAction ¶ added in v0.4.0
func (Keymap) LookupAction ¶ added in v0.3.4
LookupAction returns the appropriate action for the given termbox event
type Layout ¶ added in v0.2.5
type Layout interface { PrintStatus(string, time.Duration) DrawPrompt(*Peco) DrawScreen(*Peco, bool) MovePage(*Peco, PagingRequest) (moved bool) PurgeDisplayCache() }
Layout represents the component that controls where elements are placed on screen
type LayoutType ¶ added in v0.2.5
type LayoutType string
LayoutType describes the types of layout that peco can take
type Line ¶ added in v0.2.11
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 // Indices return the matched portion(s) of a string after filtering. // Note that while Indices may return nil, that just means that there are // no substrings to be highlighted. It doesn't mean there were no matches Indices() [][]int // 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 LineFilter ¶ added in v0.4.0
type LineFilter interface { pipeline.Acceptor SetQuery(string) Clone() LineFilter String() string }
type ListArea ¶ added in v0.2.5
type ListArea struct { *AnchorSettings // contains filtered or unexported fields }
ListArea represents the area where the actual line buffer is displayed in the screen
func NewListArea ¶ added in v0.2.5
func NewListArea(screen Screen, anchor VerticalAnchor, anchorOffset int, sortTopDown bool, styles *StyleSet) *ListArea
NewListArea creates a new ListArea struct
type Location ¶ added in v0.4.0
type Location struct {
// contains filtered or unexported fields
}
func (Location) LineNumber ¶ added in v0.4.0
func (*Location) SetLineNumber ¶ added in v0.4.0
func (*Location) SetMaxPage ¶ added in v0.4.0
func (*Location) SetPerPage ¶ added in v0.4.0
type MatchedLine ¶ added in v0.2.11
type MatchedLine struct { Line // contains filtered or unexported fields }
MatchedLine contains the indices to the matches
func NewMatchedLine ¶ added in v0.2.11
func NewMatchedLine(rl Line, matches [][]int) *MatchedLine
NewMatchedLine creates a new MatchedLine
func (MatchedLine) Indices ¶ added in v0.2.11
func (ml MatchedLine) Indices() [][]int
Indices returns the indices in the buffer that matched
type MemoryBuffer ¶ added in v0.4.0
type MemoryBuffer struct { PeriodicFunc func() // contains filtered or unexported fields }
MemoryBuffer is an implementation of Buffer
func NewMemoryBuffer ¶ added in v0.4.0
func NewMemoryBuffer() *MemoryBuffer
func (*MemoryBuffer) Accept ¶ added in v0.4.0
func (mb *MemoryBuffer) Accept(ctx context.Context, in chan interface{}, _ pipeline.OutputChannel)
func (*MemoryBuffer) Append ¶ added in v0.4.0
func (mb *MemoryBuffer) Append(l Line)
func (*MemoryBuffer) Done ¶ added in v0.4.0
func (mb *MemoryBuffer) Done() <-chan struct{}
func (*MemoryBuffer) Reset ¶ added in v0.4.0
func (mb *MemoryBuffer) Reset()
func (*MemoryBuffer) Size ¶ added in v0.4.0
func (mb *MemoryBuffer) Size() int
type PageCrop ¶ added in v0.3.0
type PageCrop struct {
// contains filtered or unexported fields
}
PageCrop filters out a new LineBuffer based on entries per page and the page number
type PagingRequest ¶
type PagingRequest interface {
Type() PagingRequestType
}
type PagingRequestType ¶ added in v0.3.4
type PagingRequestType int
PagingRequest can be sent to move the selection cursor
const ( ToLineAbove PagingRequestType = iota // ToLineAbove moves the selection to the line above ToScrollPageDown // ToScrollPageDown moves the selection to the next page ToLineBelow // ToLineBelow moves the selection to the line below ToScrollPageUp // ToScrollPageUp moves the selection to the previous page ToScrollLeft // ToScrollLeft scrolls screen to the left ToScrollRight // ToScrollRight scrolls screen to the right ToLineInPage // ToLineInPage jumps to a particular line on the page )
func (PagingRequestType) String ¶ added in v0.4.0
func (i PagingRequestType) String() string
func (PagingRequestType) Type ¶ added in v0.3.4
func (prt PagingRequestType) Type() PagingRequestType
type Peco ¶ added in v0.4.0
type Peco struct { Argv []string Stdin io.Reader Stdout io.Writer Stderr io.Writer // contains filtered or unexported fields }
Peco is the global object containing everything required to run peco. It also contains the global state of the program.
func (*Peco) ApplyConfig ¶ added in v0.4.0
func (p *Peco) ApplyConfig(opts CLIOptions) error
func (*Peco) CollectResults ¶ added in v0.4.0
func (p *Peco) CollectResults()
func (*Peco) CurrentLineBuffer ¶ added in v0.4.0
func (*Peco) LayoutType ¶ added in v0.4.0
func (*Peco) QueryExecDelay ¶ added in v0.4.0
func (*Peco) ResetCurrentLineBuffer ¶ added in v0.4.0
func (p *Peco) ResetCurrentLineBuffer()
func (*Peco) SelectionRangeStart ¶ added in v0.4.0
func (p *Peco) SelectionRangeStart() *RangeStart
func (*Peco) SetCurrentLineBuffer ¶ added in v0.4.0
func (*Peco) SetResultCh ¶ added in v0.4.0
func (*Peco) SetSingleKeyJumpMode ¶ added in v0.4.0
func (*Peco) SetupSource ¶ added in v0.4.0
func (*Peco) SingleKeyJumpIndex ¶ added in v0.4.0
func (*Peco) SingleKeyJumpMode ¶ added in v0.4.0
func (*Peco) SingleKeyJumpPrefixes ¶ added in v0.4.0
func (*Peco) SingleKeyJumpShowPrefix ¶ added in v0.4.0
func (*Peco) ToggleSingleKeyJumpMode ¶ added in v0.4.0
func (p *Peco) ToggleSingleKeyJumpMode()
type Query ¶ added in v0.4.0
type Query struct {
// contains filtered or unexported fields
}
func (*Query) DeleteRange ¶ added in v0.4.0
func (*Query) RestoreSavedQuery ¶ added in v0.4.0
func (q *Query) RestoreSavedQuery()
type RangeStart ¶ added in v0.4.0
type RangeStart struct {
// contains filtered or unexported fields
}
func (*RangeStart) Reset ¶ added in v0.4.0
func (s *RangeStart) Reset()
func (*RangeStart) SetValue ¶ added in v0.4.0
func (s *RangeStart) SetValue(n int)
func (RangeStart) Valid ¶ added in v0.4.0
func (s RangeStart) Valid() bool
func (RangeStart) Value ¶ added in v0.4.0
func (s RangeStart) Value() int
type RawLine ¶ added in v0.2.11
type RawLine struct {
// contains filtered or unexported fields
}
RawLine is the input line as sent to peco, before filtering and what not.
func NewRawLine ¶ added in v0.2.11
NewRawLine creates a new RawLine. 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 (RawLine) DisplayString ¶ added in v0.2.11
DisplayString returns the string to be displayed
func (RawLine) Indices ¶ added in v0.2.11
Indices fulfills the Line interface, but for RawLine it always returns nil
func (RawLine) IsDirty ¶ added in v0.3.0
IsDirty returns true if this line must be redrawn on the terminal
type RegexpFilter ¶ added in v0.3.0
type RegexpFilter struct {
// contains filtered or unexported fields
}
func NewCaseSensitiveFilter ¶ added in v0.3.0
func NewCaseSensitiveFilter() *RegexpFilter
func NewIgnoreCaseFilter ¶ added in v0.3.0
func NewIgnoreCaseFilter() *RegexpFilter
func NewRegexpFilter ¶ added in v0.3.0
func NewRegexpFilter() *RegexpFilter
func NewSmartCaseFilter ¶ added in v0.3.0
func NewSmartCaseFilter() *RegexpFilter
SmartCaseFilter turns ON the ignore-case flag in the regexp if the query contains a upper-case character
func (*RegexpFilter) Accept ¶ added in v0.3.0
func (rf *RegexpFilter) Accept(ctx context.Context, in chan interface{}, out pipeline.OutputChannel)
func (RegexpFilter) Clone ¶ added in v0.3.0
func (rf RegexpFilter) Clone() LineFilter
func (*RegexpFilter) OutCh ¶ added in v0.4.0
func (rf *RegexpFilter) OutCh() <-chan interface{}
func (*RegexpFilter) SetQuery ¶ added in v0.3.0
func (rf *RegexpFilter) SetQuery(q string)
func (RegexpFilter) String ¶ added in v0.3.0
func (rf RegexpFilter) String() string
type Screen ¶ added in v0.2.6
type Screen interface { Init() error Close() error Flush() error PollEvent() chan termbox.Event Print(PrintArgs) int SetCell(int, int, rune, termbox.Attribute, termbox.Attribute) Size() (int, int) SendEvent(termbox.Event) }
Screen hides termbox from the consuming code so that it can be swapped out for testing
type Selection ¶ added in v0.1.3
type Selection struct {
// contains filtered or unexported fields
}
Selection stores the line ids that were selected by the user. The contents of the Selection is always sorted from smallest to largest line ID
func NewSelection ¶ added in v0.2.11
func NewSelection() *Selection
NewSelection creates a new empty Selection
func (*Selection) Add ¶ added in v0.1.3
Add adds a new line to the selection. If the line already exists in the selection, it is silently ignored
func (*Selection) Ascend ¶ added in v0.4.0
func (s *Selection) Ascend(i btree.ItemIterator)
type SingleKeyJumpConfig ¶ added in v0.3.4
type Source ¶ added in v0.4.0
type Source struct { pipeline.OutputChannel // contains filtered or unexported fields }
Source implements pipeline.Source, and is the buffer for the input
func NewSource ¶ added in v0.4.0
Creates a new Source. Does not start processing the input until you call Setup()
func (*Source) Ready ¶ added in v0.4.0
func (s *Source) Ready() <-chan struct{}
Ready returns the "input ready" channel. It will be closed as soon as the first line of input is processed via Setup()
func (*Source) Reset ¶ added in v0.4.0
func (s *Source) Reset()
Reset resets the state of the source object so that it is ready to feed the filters
type StatusBar ¶ added in v0.2.5
type StatusBar struct { *AnchorSettings // contains filtered or unexported fields }
StatusBar draws the status message bar
func NewStatusBar ¶ added in v0.2.5
func NewStatusBar(screen Screen, anchor VerticalAnchor, anchorOffset int, styles *StyleSet) *StatusBar
NewStatusBar creates a new StatusBar struct
type StatusMsgRequest ¶ added in v0.2.10
type StatusMsgRequest struct {
// contains filtered or unexported fields
}
StatusMsgRequest specifies the string to be drawn on the status message bar and an optional delay that tells the view to clear that message
type Style ¶ added in v0.1.2
type Style struct {
// contains filtered or unexported fields
}
Style describes termbox styles
func (*Style) UnmarshalJSON ¶ added in v0.1.2
UnmarshalJSON satisfies json.RawMessage.
type StyleSet ¶ added in v0.1.2
type StyleSet struct { Basic Style `json:"Basic"` SavedSelection Style `json:"SavedSelection"` Selected Style `json:"Selected"` Query Style `json:"Query"` Matched Style `json:"Matched"` }
StyleSet holds styles for various sections
func NewStyleSet ¶ added in v0.1.2
func NewStyleSet() *StyleSet
NewStyleSet creates a new StyleSet struct
type Termbox ¶ added in v0.2.6
type Termbox struct {
// contains filtered or unexported fields
}
Termbox just hands out the processing to the termbox library
func (*Termbox) PollEvent ¶ added in v0.2.6
func (t *Termbox) PollEvent() chan termbox.Event
PollEvent returns a channel that you can listen to for termbox's events. The actual polling is done in a separate gouroutine
func (*Termbox) SendEvent ¶ added in v0.3.0
func (t *Termbox) SendEvent(_ termbox.Event)
SendEvent is used to allow programmers generate random events, but it's only useful for testing purposes. When interactiving with termbox-go, this method is a noop
type UserPrompt ¶ added in v0.2.5
type UserPrompt struct { *AnchorSettings // contains filtered or unexported fields }
UserPrompt draws the prompt line
func NewUserPrompt ¶ added in v0.2.5
func NewUserPrompt(screen Screen, anchor VerticalAnchor, anchorOffset int, prompt string, styles *StyleSet) *UserPrompt
NewUserPrompt creates a new UserPrompt struct
func (UserPrompt) Draw ¶ added in v0.2.5
func (u UserPrompt) Draw(state *Peco)
Draw draws the query prompt
type VerticalAnchor ¶ added in v0.2.5
type VerticalAnchor int
VerticalAnchor describes the direction to which elements in the layout are anchored to
const ( AnchorTop VerticalAnchor = iota + 1 // AnchorTop anchors elements towards the top of the screen AnchorBottom // AnchorBottom anchors elements towards the bottom of the screen )
func (VerticalAnchor) String ¶ added in v0.4.0
func (i VerticalAnchor) String() string