keysequence

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

func Compare

func Compare(a, b KeySequence) bool

Compare compares two KeySequence instances.

func CompareKey

func CompareKey(a, b *tcell.EventKey) bool

CompareKey compares two EventKey instances.

func FormatKey

func FormatKey(ev *tcell.EventKey) string

FormatKey is similar to tcell.EventKey.Name(), which returns a printable value of a key stroke. Format formats it according to PMS' key binding syntax.

func StartsWith

func StartsWith(a, b KeySequence) bool

StartsWith return true if a starts with b.

Types

type KeySequence

type KeySequence []*tcell.EventKey

KeySequence is an ordered sequence of keyboard events.

func (KeySequence) String

func (seq KeySequence) String() string

Format reverses a parsed key sequence into its string representation.

type Parser

type Parser struct {
	parser.Parser
}

Parser is a key sequence parser. Key sequences consists of one or more keyboard input events. Special keys are defined by using angle brackets and a hyphen, such as <C-a> for Ctrl+A, or <C-S-M-x> for Ctrl+Shift+Meta+X.

func NewParser

func NewParser(r *lexer.Scanner) *Parser

NewParser returns Parser.

func (*Parser) ParseKeySequence

func (p *Parser) ParseKeySequence() (KeySequence, error)

ParseKeySequence parses the next key sequence, which is a combination of literal keys.

func (*Parser) ParseSpecial

func (p *Parser) ParseSpecial() (key *tcell.EventKey, err error)

Parse a special key name, such as <space> or <C-M-a>.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳