keys

package
v0.0.0-...-40e63e7 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Binding

type Binding struct {
	Command  string
	Context  string
	Sequence keysequence.KeySequence
}

Binding holds a parsed, user provided key sequence.

type Sequencer

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

Sequencer holds all the keyboard bindings and their action mappings.

func NewSequencer

func NewSequencer() *Sequencer

NewSequencer returns Sequencer.

func (*Sequencer) AddBind

func (s *Sequencer) AddBind(binding Binding) error

AddBind creates a new key mapping.

func (*Sequencer) KeyInput

func (s *Sequencer) KeyInput(ev *tcell.EventKey, contexts []string) bool

KeyInput feeds a keypress to the sequencer. Returns true if there is one match or more, or false if there is no match.

func (*Sequencer) List

func (s *Sequencer) List() list.List

func (*Sequencer) Match

func (s *Sequencer) Match(contexts []string) *Binding

Match returns a key binding if the current input sequence is found.

func (*Sequencer) RemoveBind

func (s *Sequencer) RemoveBind(context string, seq keysequence.KeySequence) error

RemoveBind removes a key mapping.

func (*Sequencer) String

func (s *Sequencer) String() string

String returns the current input sequence as a string.

Jump to

Keyboard shortcuts

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