keymap

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bind

type Bind struct {
	Key         Key
	Cmd         commands.Command
	Description string
}

Struct that holds a key and a command

func (Bind) String

func (b Bind) String() string

type Key

type Key struct {
	Code tcell.Key // Special character codes.
	Char rune      // used when the key represents a single ascii char like "a" or "2".
}

Key is a structure that represents a key that can be bound to an command

func (Key) String

func (k Key) String() string

type Map

type Map []Bind

Map is a collection of keybinds

func (Map) Resolve

func (m Map) Resolve(event *tcell.EventKey) commands.Command

Resolve translates a tcell.EventKey to a command based on the bindings in the map.

If no binding could be found. commands.Noop is returned.

Jump to

Keyboard shortcuts

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