keys

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 1 Imported by: 4 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package keys maps raw input onto semantic actions and footer hint legends for viewkit applications.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisplayName added in v0.0.1

func DisplayName(key string) string

func Keys added in v0.0.1

func Keys() []string

func Register added in v0.0.1

func Register(key, name string, s Scheme)

func Use

func Use(s Scheme)

Types

type Action

type Action string
const (
	Up        Action = "nav.up"
	Down      Action = "nav.down"
	Left      Action = "nav.left"
	Right     Action = "nav.right"
	Confirm   Action = "confirm"
	Cancel    Action = "cancel"
	Quit      Action = "quit"
	FocusNext Action = "focus.next"
	FocusPrev Action = "focus.prev"
	Inc       Action = "inc"
	Dec       Action = "dec"
	Erase     Action = "erase"
	PageUp    Action = "page.up"
	PageDown  Action = "page.down"
)

type Binding

type Binding struct {
	Keys   []string
	Action Action
	Glyph  string
	Label  string
}

func (Binding) DisplayGlyph

func (b Binding) DisplayGlyph() string

func (Binding) WithGlyph

func (b Binding) WithGlyph(glyph string) Binding

func (Binding) WithLabel

func (b Binding) WithLabel(label string) Binding

type Map

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

func NewMap

func NewMap(bindings ...Binding) *Map

func (*Map) Action

func (m *Map) Action(input string) (a Action, ok bool)

func (*Map) Has

func (m *Map) Has(a Action) bool

func (*Map) Hint

func (m *Map) Hint(a Action) [2]string

func (*Map) HintLabeled

func (m *Map) HintLabeled(a Action, label string) [2]string

func (*Map) Hints

func (m *Map) Hints(actions ...Action) [][2]string

type Scheme

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

func Cur

func Cur() Scheme

func Default

func Default() Scheme

func Named added in v0.0.1

func Named(key string) (Scheme, bool)

func (Scheme) Binding

func (s Scheme) Binding(a Action) Binding

func (Scheme) With

func (s Scheme) With(overrides ...Binding) Scheme

Jump to

Keyboard shortcuts

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