processors

package
v0.9.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ModalInputProcessor

type ModalInputProcessor struct {
	// contains filtered or unexported fields
}

ModalInputProcessor is an input processor that can take any number of input overlays over its base input processor. It delegates all processing to its processors. Implements input.ModalInputProcessor.

func NewModalInputProcessor

func NewModalInputProcessor(base input.SimpleInputProcessor) *ModalInputProcessor

NewModalInputProcessor returns a pointer to a new ModalInputProcessor with the given base processor and no overlays.

func (*ModalInputProcessor) ApplyModalOverlay

func (p *ModalInputProcessor) ApplyModalOverlay(overlay input.SimpleInputProcessor) (index uint)

ApplyModalOverlay applies an overlay to this processor. It returns the processors index, by which in the future, all overlays down to and including this overlay can be removed

func (*ModalInputProcessor) CapturesInput

func (p *ModalInputProcessor) CapturesInput() bool

CapturesInput returns whether this processor "captures" input, i.E. whether it ought to take priority in processing over other processors. This is useful, e.g., for prioritizing processors with partial input sequences or for such overlays, that are to take complete priority by completely gobbling all input.

func (*ModalInputProcessor) GetHelp

func (p *ModalInputProcessor) GetHelp() input.Help

GetHelp returns the input help map for this processor.

func (*ModalInputProcessor) PopModalOverlay

func (p *ModalInputProcessor) PopModalOverlay() error

PopModalOverlay removes the topmost overlay from this processor.

func (*ModalInputProcessor) PopModalOverlays

func (p *ModalInputProcessor) PopModalOverlays(index uint)

PopModalOverlays pops all overlays down to and including the one at the specified index.

func (*ModalInputProcessor) ProcessInput

func (p *ModalInputProcessor) ProcessInput(key input.Key) bool

ProcessInput attempts to process the provided input. Returns whether the provided input "applied", i.E. the processor performed an action based on the input. ModalInputProcessor delegates input processing to its topmost overlay processor or -- if no overlays are present -- its base processor.

type TextInputProcessor

type TextInputProcessor struct {
	// contains filtered or unexported fields
}

TextInputProcessor is a SimpleInputProcessor specifically for text input. It can have a number of defined mappings for non-runes (e.g. ESC for a callback to remove this processor as an overlay). Any runes it is asked to process will be given to its callback function for runes, which could, e.g., append the given rune to a string.

func NewTextInputProcessor

func NewTextInputProcessor(
	normalModeMappings map[input.Keyspec]action.Action,
	runeCallback func(r rune),
) (*TextInputProcessor, error)

NewTextInputProcessor returns a pointer to a new NewTextInputProcessor.

func (*TextInputProcessor) CapturesInput

func (p *TextInputProcessor) CapturesInput() bool

CapturesInput returns whether this processor "captures" input, i.E. whether it ought to take priority in processing over other processors. This is useful, e.g., for prioritizing processors with partial input sequences or for such overlays, that are to take complete priority by completely gobbling all input.

func (*TextInputProcessor) GetHelp

func (p *TextInputProcessor) GetHelp() input.Help

GetHelp returns the input help map for this processor.

func (*TextInputProcessor) ProcessInput

func (p *TextInputProcessor) ProcessInput(key input.Key) bool

ProcessInput attempts to process the provided input. Returns whether the provided input "applied", i.E. the processor performed an action based on the input.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL