Documentation ¶
Index ¶
- Constants
- func IsTty(fd uintptr) bool
- func IsValidLayoutType(v LayoutType) bool
- func IsValidVerticalAnchor(anchor VerticalAnchor) bool
- func LocateRcfile() (string, error)
- func TtyReady() error
- func TtyTerm()
- type Action
- type ActionFunc
- type AnchorSettings
- type BasicLayout
- type BufferReader
- type CaseSensitiveMatcher
- type Config
- type Ctx
- func (c *Ctx) AddWaitGroup(v int)
- func (c *Ctx) Buffer() []Line
- func (p *Ctx) CaretPos() int
- func (c *Ctx) DrawMatches(m []Line)
- func (c *Ctx) DrawPrompt()
- func (c *Ctx) ExecQuery() bool
- func (c Ctx) ExitStatus() int
- func (c *Ctx) ExitWith(i int)
- func (c *Ctx) GetCurrent() []Line
- func (c *Ctx) GetCurrentAt(i int) Line
- func (c *Ctx) GetCurrentLen() int
- func (c *Ctx) GetLines() []Line
- func (c *Ctx) GetLinesCount() int
- func (c *Ctx) IsBufferOverflowing() bool
- func (c *Ctx) IsRangeMode() bool
- func (c *Ctx) LoadCustomMatcher() error
- func (c *Ctx) Matcher() Matcher
- func (p *Ctx) MoveCaretPos(offset int)
- func (c *Ctx) NewBufferReader(r io.ReadCloser) *BufferReader
- func (c *Ctx) NewFilter() *Filter
- func (c *Ctx) NewInput() *Input
- func (c *Ctx) NewSignalHandler() *signalHandler
- func (c *Ctx) NewView() *View
- func (c *Ctx) ReadConfig(file string) error
- func (c *Ctx) Refresh()
- func (c *Ctx) ReleaseWaitGroup()
- func (c *Ctx) ResultCh() <-chan Line
- func (c *Ctx) SelectionAdd(x int)
- func (c *Ctx) SelectionClear()
- func (c *Ctx) SelectionContains(n int) bool
- func (c *Ctx) SelectionLen() uint64
- func (c *Ctx) SelectionRemove(x int)
- func (p *Ctx) SetCaretPos(where int)
- func (c *Ctx) SetCurrent(newMatches []Line)
- func (c *Ctx) SetLines(newLines []Line)
- func (c *Ctx) SetPrompt(p string)
- func (c *Ctx) SetQuery(q []rune)
- func (c *Ctx) SetSavedQuery(q []rune)
- func (c *Ctx) WaitDone()
- type CtxOptions
- type CustomMatcher
- type Filter
- type FilterQuery
- type Hub
- func (h *Hub) Batch(f func())
- func (h *Hub) DrawCh() chan HubReq
- func (h *Hub) LoopCh() chan struct{}
- func (h *Hub) PagingCh() chan HubReq
- func (h *Hub) QueryCh() chan HubReq
- func (h *Hub) SendDraw(matches []Line)
- func (h *Hub) SendDrawPrompt()
- func (h *Hub) SendPaging(x PagingRequest)
- func (h *Hub) SendQuery(q string)
- func (h *Hub) SendStatusMsg(q string)
- func (h *Hub) SendStatusMsgAndClear(q string, clearDelay time.Duration)
- func (h *Hub) StatusMsgCh() chan HubReq
- func (h *Hub) Stop()
- type HubReq
- type IgnoreCaseMatcher
- type Input
- type Keymap
- type Layout
- type LayoutType
- type Line
- type ListArea
- type MatchedLine
- type Matcher
- type MatcherSet
- type PageInfo
- type PagingRequest
- type RawLine
- type RegexpMatcher
- type Screen
- type Selection
- type SmartCaseMatcher
- type StatusBar
- type StatusMsgRequest
- type Style
- type StyleSet
- func (s StyleSet) BasicBG() termbox.Attribute
- func (s StyleSet) BasicFG() termbox.Attribute
- func (s StyleSet) MatchedBG() termbox.Attribute
- func (s StyleSet) MatchedFG() termbox.Attribute
- func (s StyleSet) QueryBG() termbox.Attribute
- func (s StyleSet) QueryFG() termbox.Attribute
- func (s StyleSet) SavedSelectionBG() termbox.Attribute
- func (s StyleSet) SavedSelectionFG() termbox.Attribute
- func (s StyleSet) SelectedBG() termbox.Attribute
- func (s StyleSet) SelectedFG() termbox.Attribute
- type Termbox
- type UserPrompt
- type VerticalAnchor
- type View
Constants ¶
const ( // LayoutTypeTopDown is the default. All 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
Variables ¶
This section is empty.
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(keyseq.KeyList) Execute(*Input, 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
type ActionFunc func(*Input, termbox.Event)
ActionFunc is a type of Action that is basically just a callback.
func (ActionFunc) Execute ¶ added in v0.2.0
func (a ActionFunc) Execute(i *Input, 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 Actin 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(k keyseq.KeyList)
RegisterKeySequence satisfies the Action interface for AfterFun. 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(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
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(ctx *Ctx) *BasicLayout
NewBottomUpLayout creates a new Layout in bottom-up format
func NewDefaultLayout ¶ added in v0.2.5
func NewDefaultLayout(ctx *Ctx) *BasicLayout
NewDefaultLayout creates a new Layout in the default format (top-down)
func (*BasicLayout) CalculatePage ¶ added in v0.2.5
func (l *BasicLayout) CalculatePage(targets []Line, perPage int) error
CalculatePage calculates which page we're displaying
func (*BasicLayout) DrawPrompt ¶ added in v0.2.9
func (l *BasicLayout) DrawPrompt()
func (*BasicLayout) DrawScreen ¶ added in v0.2.5
func (l *BasicLayout) DrawScreen(targets []Line)
DrawScreen draws the entire screen
func (*BasicLayout) MovePage ¶ added in v0.2.5
func (l *BasicLayout) MovePage(p PagingRequest)
MovePage moves the cursor
type BufferReader ¶ added in v0.1.12
type BufferReader struct { *Ctx // contains filtered or unexported fields }
BufferReader reads lines from the input, either Stdin or a file. If the incoming data is endless, it keeps reading and adding to the search buffer, as long as it can.
If you would like to limit the number of lines to keep in the buffer, you should set --buffer-size to a number > 0
func (*BufferReader) InputReadyCh ¶ added in v0.2.0
func (b *BufferReader) InputReadyCh() <-chan struct{}
InputReadyCh returns a channel which, when the input starts coming in, sends a struct{}{}
func (*BufferReader) Loop ¶ added in v0.1.12
func (b *BufferReader) Loop()
Loop keeps reading from the input
type CaseSensitiveMatcher ¶ added in v0.1.1
type CaseSensitiveMatcher struct {
*RegexpMatcher
}
CaseSensitiveMatcher extends the RegxpMatcher, but always turns off the ignore-case flag in the regexp
func NewCaseSensitiveMatcher ¶ added in v0.1.2
func NewCaseSensitiveMatcher(enableSep bool) *CaseSensitiveMatcher
NewCaseSensitiveMatcher creates a new CaseSensitiveMatcher
func (*CaseSensitiveMatcher) String ¶ added in v0.1.1
func (m *CaseSensitiveMatcher) String() string
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 Style *StyleSet `json:"Style"` Prompt string `json:"Prompt"` Layout string `json:"Layout"` CustomMatcher map[string][]string }
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 Ctx ¶
type Ctx struct { *Hub *FilterQuery *MatcherSet // contains filtered or unexported fields }
Ctx contains all the important data. while you can easily access data in this struct from anwyehre, only do so via channels
func NewCtx ¶
func NewCtx(o CtxOptions) *Ctx
func (*Ctx) AddWaitGroup ¶
func (*Ctx) DrawMatches ¶
func (*Ctx) DrawPrompt ¶ added in v0.2.9
func (c *Ctx) DrawPrompt()
func (Ctx) ExitStatus ¶
ExitStatus() returns the exit status that we think should be used
func (*Ctx) GetCurrent ¶ added in v0.2.11
func (*Ctx) GetCurrentAt ¶ added in v0.2.11
func (*Ctx) GetCurrentLen ¶ added in v0.2.11
func (*Ctx) GetLinesCount ¶ added in v0.2.11
func (*Ctx) IsBufferOverflowing ¶ added in v0.2.0
func (*Ctx) IsRangeMode ¶ added in v0.2.0
func (*Ctx) LoadCustomMatcher ¶ added in v0.1.3
func (*Ctx) MoveCaretPos ¶ added in v0.2.11
func (*Ctx) NewBufferReader ¶ added in v0.1.12
func (c *Ctx) NewBufferReader(r io.ReadCloser) *BufferReader
func (*Ctx) NewSignalHandler ¶ added in v0.2.0
func (c *Ctx) NewSignalHandler() *signalHandler
func (*Ctx) ReadConfig ¶
func (*Ctx) ReleaseWaitGroup ¶
func (c *Ctx) ReleaseWaitGroup()
func (*Ctx) SelectionAdd ¶ added in v0.2.11
func (*Ctx) SelectionClear ¶ added in v0.2.11
func (c *Ctx) SelectionClear()
func (*Ctx) SelectionContains ¶ added in v0.2.11
func (*Ctx) SelectionLen ¶ added in v0.2.11
func (*Ctx) SelectionRemove ¶ added in v0.2.11
func (*Ctx) SetCaretPos ¶ added in v0.2.11
func (*Ctx) SetCurrent ¶ added in v0.2.11
func (*Ctx) SetSavedQuery ¶ added in v0.2.11
type CtxOptions ¶ added in v0.2.0
type CtxOptions interface { // EnableNullSep should return if the null separator is // enabled (--null) EnableNullSep() bool // BufferSize should return the buffer size. By default (i.e. // when it returns 0), the buffer size is unlimited. // (--buffer-size) BufferSize() int // InitialIndex is the line number to put the cursor on // when peco starts InitialIndex() int // LayoutType returns the name of the layout to use LayoutType() string }
CtxOptions is the interface that defines that options can be passed in from the command line
type CustomMatcher ¶ added in v0.1.3
type CustomMatcher struct {
// contains filtered or unexported fields
}
CustomMatcher spawns a new process to filter the buffer in peco, and uses the output in its Stdout to figure out what to display
func NewCustomMatcher ¶ added in v0.1.3
func NewCustomMatcher(enableSep bool, name string, args []string) *CustomMatcher
NewCustomMatcher creates a new CustomMatcher
func (*CustomMatcher) Line ¶ added in v0.2.11
func (m *CustomMatcher) Line(quit chan struct{}, q string, buffer []Line) []Line
Match matches `q` aginst `buffer`
func (*CustomMatcher) String ¶ added in v0.1.3
func (m *CustomMatcher) String() string
func (*CustomMatcher) Verify ¶ added in v0.1.11
func (m *CustomMatcher) Verify() error
Verify checks to see that the executable given to CustomMatcher is actual found and is executable via exec.LookPath
type Filter ¶
type Filter struct { *Ctx // contains filtered or unexported fields }
Filter is responsible for the actual "grep" part of peco
type FilterQuery ¶ added in v0.2.6
type FilterQuery struct {
// contains filtered or unexported fields
}
func (*FilterQuery) AppendQuery ¶ added in v0.2.6
func (q *FilterQuery) AppendQuery(r rune)
func (*FilterQuery) InsertQueryAt ¶ added in v0.2.6
func (q *FilterQuery) InsertQueryAt(ch rune, where int)
func (FilterQuery) Query ¶ added in v0.2.6
func (q FilterQuery) Query() []rune
func (FilterQuery) QueryLen ¶ added in v0.2.6
func (q FilterQuery) QueryLen() int
func (FilterQuery) QueryString ¶ added in v0.2.9
func (q FilterQuery) QueryString() string
func (FilterQuery) SavedQuery ¶ added in v0.2.11
func (q FilterQuery) SavedQuery() []rune
type Hub ¶ added in v0.2.1
type Hub struct {
// contains filtered or unexported fields
}
Hub acts as the messaging hub between components -- that is, it controls how the communication that goes through channels are handled.
func (*Hub) Batch ¶ added in v0.2.1
func (h *Hub) Batch(f func())
Batch allows you to synchronously send messages during the scope of f() being executed.
func (*Hub) LoopCh ¶ added in v0.2.1
func (h *Hub) LoopCh() chan struct{}
LoopCh returns the channel to control the main execution loop. Nothing should ever be sent through this channel. The only way the channel communicates anything to its receivers is when it is closed -- which is when peco is done.
func (*Hub) SendDrawPrompt ¶ added in v0.2.9
func (h *Hub) SendDrawPrompt()
SendDrawPrompt sends a request to redraw the prompt only
func (*Hub) SendPaging ¶ added in v0.2.1
func (h *Hub) SendPaging(x PagingRequest)
SendPaging sends a request to move the cursor around
func (*Hub) SendQuery ¶ added in v0.2.1
SendQuery sends the query string to be processed by the Filter
func (*Hub) SendStatusMsg ¶ added in v0.2.1
SendStatusMsg sends a string to be displayed in the status message
func (*Hub) SendStatusMsgAndClear ¶ added in v0.2.10
func (*Hub) StatusMsgCh ¶ added in v0.2.1
StatusMsgCh returns the channel to update the status message
type HubReq ¶ added in v0.2.1
type HubReq struct {
// contains filtered or unexported fields
}
HubReq is a wrapper around the actual requst value that needs to be passed. It contains an optional channel field which can be filled to force synchronous communication between the sender and receiver
func (HubReq) DataInterface ¶ added in v0.2.1
func (hr HubReq) DataInterface() interface{}
DataInterface returns the underlying data as interface{}
func (HubReq) DataString ¶ added in v0.2.1
DataString returns the underlying data as a string. Panics if type conversion fails.
type IgnoreCaseMatcher ¶ added in v0.1.1
type IgnoreCaseMatcher struct {
*RegexpMatcher
}
IgnoreCaseMatcher extends the RegexpMatcher, and always turns ON the ignore-case flag in the regexp
func NewIgnoreCaseMatcher ¶ added in v0.1.2
func NewIgnoreCaseMatcher(enableSep bool) *IgnoreCaseMatcher
NewIgnoreCaseMatcher creates a new IgnoreCaseMatcher
func (*IgnoreCaseMatcher) String ¶ added in v0.1.1
func (m *IgnoreCaseMatcher) String() string
type Input ¶
type Input struct { *Ctx // contains filtered or unexported fields }
Input handles input events from termbox.
type Keymap ¶
type Keymap struct { Config map[string]string Action map[string][]string // custom actions Keyseq *keyseq.Keyseq }
Keymap holds all the key sequence to action map
func (Keymap) ApplyKeybinding ¶ added in v0.2.0
func (km Keymap) ApplyKeybinding()
ApplyKeybinding applies all of the custom key bindings on top of the default key bindings
type Layout ¶ added in v0.2.5
type Layout interface { PrintStatus(string, time.Duration) DrawPrompt() DrawScreen([]Line) MovePage(PagingRequest) }
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 { Buffer() string // Raw buffer, may contain null DisplayString() string // Line to be displayed Output() string // Output string to be displayed after peco is done Indices() [][]int // If the type allows, indices into matched portions of the string }
Line defines the interface for each of the line that peco uses to display and match against queries. Note that to make drawing easier, we have a RawLine and MatchedLine types
type ListArea ¶ added in v0.2.5
type ListArea struct { *Ctx *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(ctx *Ctx, anchor VerticalAnchor, anchorOffset int, sortTopDown bool) *ListArea
NewListArea creates a new ListArea struct
type MatchedLine ¶ added in v0.2.11
type MatchedLine struct {
// contains filtered or unexported fields
}
MatchedLine contains the actual match, and the indices to the matches in the line
func NewMatchedLine ¶ added in v0.2.11
func NewMatchedLine(v string, enableSep bool, m [][]int) *MatchedLine
NewMatchedLine creates a new MatchedLine struct
func (MatchedLine) DisplayString ¶ added in v0.2.11
func (m MatchedLine) DisplayString() string
func (MatchedLine) Indices ¶ added in v0.2.11
func (d MatchedLine) Indices() [][]int
Indices returns the indices in the buffer that matched
type Matcher ¶ added in v0.1.1
type Matcher interface { // Match takes in three parameters. // // The first chan is the channel where cancel requests are sent. // If you receive a request here, you should stop running your query. // // The second is the query. Do what you want with it // // The third is the buffer in which to match the query against. Line(chan struct{}, string, []Line) []Line String() string // This is fugly. We just added a method only for CustomMatcner. // Must think about this again Verify() error }
Matcher interface defines the API for things that want to match against the buffer
type MatcherSet ¶ added in v0.2.11
type MatcherSet struct {
// contains filtered or unexported fields
}
func NewMatcherSet ¶ added in v0.2.11
func NewMatcherSet() *MatcherSet
func (*MatcherSet) Add ¶ added in v0.2.11
func (s *MatcherSet) Add(m Matcher) error
func (*MatcherSet) Get ¶ added in v0.2.11
func (s *MatcherSet) Get(i int) Matcher
func (*MatcherSet) GetCurrent ¶ added in v0.2.11
func (s *MatcherSet) GetCurrent() Matcher
func (*MatcherSet) Rotate ¶ added in v0.2.11
func (s *MatcherSet) Rotate()
Rotate rotates the matchers
func (*MatcherSet) SetCurrentByName ¶ added in v0.2.11
func (s *MatcherSet) SetCurrentByName(n string) bool
type PagingRequest ¶
type PagingRequest int
PagingRequest can be sent to move the selection cursor
const ( // ToLineAbove moves the selection to the line above ToLineAbove PagingRequest = iota // ToScrollPageDown moves the selection to the next page ToScrollPageDown // ToLineBelow moves the selection to the line below ToLineBelow // ToScrollPageUp moves the selection to the previous page ToScrollPageUp )
type RawLine ¶ added in v0.2.11
type RawLine struct {
// contains filtered or unexported fields
}
RawLine implements the Line interface. It represents a line with no matches, which means that it can only be used in the initial unfiltered view
func NewRawLine ¶ added in v0.2.11
NewRawLine creates a RawLine struct
func (RawLine) DisplayString ¶ added in v0.2.11
func (m RawLine) DisplayString() string
type RegexpMatcher ¶ added in v0.1.2
type RegexpMatcher struct {
// contains filtered or unexported fields
}
RegexpMatcher is the most basic matcher
func NewRegexpMatcher ¶ added in v0.1.2
func NewRegexpMatcher(enableSep bool) *RegexpMatcher
NewRegexpMatcher creates a new RegexpMatcher
func (*RegexpMatcher) Line ¶ added in v0.2.11
func (m *RegexpMatcher) Line(quit chan struct{}, q string, buffer []Line) []Line
Match does the heavy lifting, and matches `q` against `buffer`. While it is doing the match, it also listens for messages via `quit`. If anything is received via `quit`, the match is halted.
func (*RegexpMatcher) MatchAllRegexps ¶ added in v0.1.2
func (m *RegexpMatcher) MatchAllRegexps(regexps []*regexp.Regexp, line string) [][]int
MatchAllRegexps matches all the regexps in `regexps` against line
func (*RegexpMatcher) String ¶ added in v0.1.2
func (m *RegexpMatcher) String() string
func (*RegexpMatcher) Verify ¶ added in v0.1.11
func (m *RegexpMatcher) Verify() error
Verify always returns nil
type Screen ¶ added in v0.2.6
type Screen interface { Clear(termbox.Attribute, termbox.Attribute) error Flush() error PollEvent() chan termbox.Event SetCell(int, int, rune, termbox.Attribute, termbox.Attribute) Size() (int, int) }
Screen hides termbox from tne 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 numbers that were selected by the user. The contents of the Selection is always sorted from smallest to largest line number
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 number to the selection. If the line already exists in the selection, it is silently ignored
func (*Selection) Invert ¶ added in v0.2.11
Invert inverts the selection - if items 2 and 3 are selected out of 10 items, then items 1 and items 4 to 10 are selected after call to this method
type SmartCaseMatcher ¶ added in v0.2.9
type SmartCaseMatcher struct {
*RegexpMatcher
}
SmartCaseMatcher turns ON the ignore-case flag in the regexp if the query contains a upper-case character
func NewSmartCaseMatcher ¶ added in v0.2.9
func NewSmartCaseMatcher(enableSep bool) *SmartCaseMatcher
NewSmartCaseMatcher creates a new SmartCaseMatcher
func (*SmartCaseMatcher) String ¶ added in v0.2.9
func (m *SmartCaseMatcher) String() string
type StatusBar ¶ added in v0.2.5
type StatusBar struct { *Ctx *AnchorSettings // contains filtered or unexported fields }
StatusBar draws the status message bar
func NewStatusBar ¶ added in v0.2.5
func NewStatusBar(ctx *Ctx, anchor VerticalAnchor, anchorOffset int) *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
func (StyleSet) SavedSelectionBG ¶ added in v0.2.5
func (s StyleSet) SavedSelectionBG() termbox.Attribute
func (StyleSet) SavedSelectionFG ¶ added in v0.2.5
func (s StyleSet) SavedSelectionFG() termbox.Attribute
func (StyleSet) SelectedBG ¶ added in v0.2.5
func (s StyleSet) SelectedBG() termbox.Attribute
func (StyleSet) SelectedFG ¶ added in v0.2.5
func (s StyleSet) SelectedFG() termbox.Attribute
type Termbox ¶ added in v0.2.6
type Termbox struct{}
Termbox just hands out the processing to the termbox library
type UserPrompt ¶ added in v0.2.5
type UserPrompt struct { *Ctx *AnchorSettings // contains filtered or unexported fields }
UserPrompt draws the prompt line
func NewUserPrompt ¶ added in v0.2.5
func NewUserPrompt(ctx *Ctx, anchor VerticalAnchor, anchorOffset int) *UserPrompt
NewUserPrompt creates a new UserPrompt struct
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 anchors elements towards the top of the screen AnchorTop VerticalAnchor = iota + 1 // AnchorBottom anchors elements towards the bottom of the screen AnchorBottom )