Documentation ¶
Overview ¶
Package fastcopy implements the core fastcopy functionality.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnnotationStyle ¶ added in v0.13.0
type AnnotationStyle struct { // Matched text that is still a candidate for selection. Match tcell.Style // Matched text that is no longer a candidate for selection. Skipped tcell.Style // Label that the user must type to select the hint. Label tcell.Style // Part of a multi-character label that the user has already typed. LabelTyped tcell.Style }
AnnotationStyle is the style of annotations for hints and matched text.
type Handler ¶
type Handler interface { // HandleSelection reports the hint label and the corresponding matched // text. HandleSelection(Selection) }
Handler handles events from the widget.
type Match ¶ added in v0.8.0
type Match struct { // Matcher is the name of the matcher that found this match. Matcher string // Range identifies the matched area. Range Range }
Match is a single entry matched by fastcopy.
type Range ¶
type Range struct{ Start, End int }
Range specifies a range of offsets in a text, referring to the [start:end) subslice of the text.
type Selection ¶ added in v0.8.0
type Selection struct { // Text is the matched text. Text string // Matchers is a list of names of matchers that matched this text. // Invariant: this list contains at least one item. Matchers []string // Shift reports whether shift was pressed when this value was // selected. Shift bool }
Selection is a choice made by the user in the fastcopy UI.
type Style ¶
type Style struct { Normal tcell.Style // normal text Match tcell.Style // matched text SkippedMatch tcell.Style // matched text that is not selected HintLabel tcell.Style // labels for hints HintLabelInput tcell.Style // typed portion of hints // Multi-select mode: SelectedMatch tcell.Style // one of the selected matches DeselectLabel tcell.Style // label for deselection }
Style configures the display style of the widget.
type Widget ¶
type Widget struct {
// contains filtered or unexported fields
}
Widget is the main fastcopy widget. It displays some fixed text with zero or more hints and unique prefix-free labels next to each hint to select that label.
func (*Widget) HandleEvent ¶
HandleEvent handles input for the widget. This only responds to text input, and delegates everything else to the caller.
type WidgetConfig ¶
type WidgetConfig struct { // Text to display on the widget. Text string // Matched offsets in text. Matches []Match // Alphabet we'll use to generate labels. HintAlphabet []rune // Handler handles events from the widget. This includes hint // selection. Handler Handler // Style configures the look of the widget. Style Style // contains filtered or unexported fields }
WidgetConfig configures the fastcopy widget.
func (*WidgetConfig) Build ¶
func (cfg *WidgetConfig) Build() *Widget
Build builds a new Fastcopy widget using the provided configuration.