Documentation
¶
Overview ¶
Package filter provides a termshark-specific edit widget which changes color according to the validity of its input, and which activates a drop-down menu of possible completions for the term at point.
Index ¶
- Variables
- type AppFilterCB
- type DisplayFilterValidator
- func (f *DisplayFilterValidator) Kill() (bool, error)
- func (f *DisplayFilterValidator) SetEmpty(cb IValidateCB)
- func (f *DisplayFilterValidator) SetInvalid(cb IValidateCB)
- func (f *DisplayFilterValidator) SetKilled(cb IValidateCB)
- func (f *DisplayFilterValidator) SetValid(cb IValidateCB)
- func (f *DisplayFilterValidator) Validate(filter string)
- type EmptyCB
- type IValidateCB
- type IValidator
- type IntermediateCB
- type InvalidCB
- type Options
- type Pos
- type SubmitCB
- type ValidCB
- type ValidateCB
- type Widget
- func (w *Widget) Close() error
- func (w *Widget) IsValid() bool
- func (w *Widget) Menus() []gowid.IMenuCompatible
- func (w *Widget) OnEmpty(f gowid.IWidgetChangedCallback)
- func (w *Widget) OnIntermediate(f gowid.IWidgetChangedCallback)
- func (w *Widget) OnInvalid(f gowid.IWidgetChangedCallback)
- func (w *Widget) OnSubmit(f gowid.IWidgetChangedCallback)
- func (w *Widget) OnValid(f gowid.IWidgetChangedCallback)
- func (w *Widget) Render(size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) gowid.ICanvas
- func (w *Widget) RenderSize(size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) gowid.IRenderBox
- func (w *Widget) SetValue(v string, app gowid.IApp)
- func (w *Widget) UpdateCompletions(app gowid.IApp)
- func (w *Widget) UserInput(ev interface{}, size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) bool
- func (w *Widget) Value() string
Constants ¶
This section is empty.
Variables ¶
var Goroutinewg *sync.WaitGroup
This is a debugging aid - I use it to ensure goroutines stop as expected. If they don't the main program will hang at termination.
Functions ¶
This section is empty.
Types ¶
type AppFilterCB ¶
type DisplayFilterValidator ¶ added in v2.4.0
type DisplayFilterValidator struct { Valid IValidateCB Invalid IValidateCB KilledCB IValidateCB EmptyCB IValidateCB Cmd *exec.Cmd }
func (*DisplayFilterValidator) Kill ¶ added in v2.4.0
func (f *DisplayFilterValidator) Kill() (bool, error)
func (*DisplayFilterValidator) SetEmpty ¶ added in v2.4.0
func (f *DisplayFilterValidator) SetEmpty(cb IValidateCB)
func (*DisplayFilterValidator) SetInvalid ¶ added in v2.4.0
func (f *DisplayFilterValidator) SetInvalid(cb IValidateCB)
func (*DisplayFilterValidator) SetKilled ¶ added in v2.4.0
func (f *DisplayFilterValidator) SetKilled(cb IValidateCB)
func (*DisplayFilterValidator) SetValid ¶ added in v2.4.0
func (f *DisplayFilterValidator) SetValid(cb IValidateCB)
func (*DisplayFilterValidator) Validate ¶ added in v2.4.0
func (f *DisplayFilterValidator) Validate(filter string)
type IValidateCB ¶
type IValidateCB interface {
Call(filter string)
}
type IValidator ¶ added in v2.4.0
type IValidator interface { SetValid(cb IValidateCB) SetInvalid(cb IValidateCB) SetKilled(cb IValidateCB) SetEmpty(cv IValidateCB) Kill() (bool, error) Validate(filter string) }
IValidator is passed to the filter constructor
type IntermediateCB ¶
type IntermediateCB struct{}
type Options ¶
type Options struct { Completer fields.IPrefixCompleter MenuOpener menu.IOpener Position Pos Validator IValidator MaxCompletions int }
type ValidateCB ¶
type ValidateCB struct { App gowid.IApp Fn AppFilterCB }
func (*ValidateCB) Call ¶
func (v *ValidateCB) Call(filter string)
type Widget ¶
type Widget struct { *gowid.Callbacks gowid.IsSelectable // contains filtered or unexported fields }
func (*Widget) Menus ¶
func (w *Widget) Menus() []gowid.IMenuCompatible
func (*Widget) OnEmpty ¶ added in v2.4.0
func (w *Widget) OnEmpty(f gowid.IWidgetChangedCallback)
func (*Widget) OnIntermediate ¶
func (w *Widget) OnIntermediate(f gowid.IWidgetChangedCallback)
func (*Widget) OnInvalid ¶
func (w *Widget) OnInvalid(f gowid.IWidgetChangedCallback)
func (*Widget) OnSubmit ¶
func (w *Widget) OnSubmit(f gowid.IWidgetChangedCallback)
func (*Widget) OnValid ¶
func (w *Widget) OnValid(f gowid.IWidgetChangedCallback)
func (*Widget) RenderSize ¶
func (w *Widget) RenderSize(size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) gowid.IRenderBox
func (*Widget) UpdateCompletions ¶
Start an asynchronous routine to update the drop-down menu with completion options. Runs on a small delay so it can be cancelled and restarted if the user is typing quickly.
func (*Widget) UserInput ¶
func (w *Widget) UserInput(ev interface{}, size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) bool
Reject tab because I want it to switch views. Not intended to be transferable. Reject down because accepting it triggers the OnCursorSet callback, which re-evaluates the filter value - the user sees it go orange briefly, which is unpleasant.