keys

package
v1.0.16 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalID

func CanonicalID(key tcell.Key, r rune, mod tcell.ModMask) string

CanonicalID returns a unique identifier for a parsed key combination.

func IsReserved

func IsReserved(key tcell.Key, r rune, mod tcell.ModMask) bool

IsReserved reports whether the given key combination is reserved for navigation and should not be reassigned. Only unmodified keys are checked.

func NormalizeEvent

func NormalizeEvent(ev *tcell.EventKey) (tcell.Key, rune, tcell.ModMask)

NormalizeEvent converts an EventKey into a canonical (key,rune,mod) triple. Ctrl+A style events are normalized to KeyRune with the corresponding rune.

func NormalizeNavigationEvent added in v1.0.15

func NormalizeNavigationEvent(ev *tcell.EventKey) *tcell.EventKey

NormalizeNavigationEvent normalizes terminal key events for in-app navigation.

In particular, many UIs (including tview forms/buttons) expect Shift+Tab to be represented as KeyBacktab. Some terminals/tcell versions instead emit KeyTab with ModShift. This helper converts the latter to KeyBacktab so widgets can reliably navigate backwards.

func Parse

func Parse(spec string) (tcell.Key, rune, tcell.ModMask, error)

Parse converts a key specification like "Ctrl+A" or "F5" to tcell values. It returns the key, optional rune, and modifier mask.

func ToChar

func ToChar(k tcell.Key) (rune, bool)

ToChar converts a tcell.Key to its rune representation if it's a Ctrl+<char> key.

func Validate

func Validate(spec string) error

Validate returns an error if the key specification is not recognized.

Types

This section is empty.

Jump to

Keyboard shortcuts

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