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 Handler ¶
type Handler interface {
// HandleSelection reports the hint label and the corresponding matched
// text.
HandleSelection(hintLabel, text string)
}
Handler handles events from the widget.
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 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
}
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 []Range
// Alphabet we'll use to generate labels.
HintAlphabet []rune
// Handler handles events from the widget. This includes hint
// selection.
Handler Handler
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.