keys

package
v1.9.2 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package keys defines the TUI's global key map on bubbles/v2/key, plus its bubbles/v2/help integration. Keeping the bindings data-driven (rather than string-matching in Update) lets the help bar render the same source of truth the reducer dispatches on.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bindings

type Bindings struct {
	Short []key.Binding
	Full  [][]key.Binding
}

Bindings is a reusable, data-driven help.KeyMap: an explicit short-help list plus full-help columns. A page builds one per frame from its current state, so the help bar renders the same source of truth the reducer dispatches on — a capability- or focus-gated binding simply is or is not included, rather than being filtered by a second, drift-prone code path.

func (Bindings) FullHelp

func (b Bindings) FullHelp() [][]key.Binding

FullHelp implements help.KeyMap.

func (Bindings) ShortHelp

func (b Bindings) ShortHelp() []key.Binding

ShortHelp implements help.KeyMap.

type Map

type Map struct {
	// NextTab / PrevTab cycle tabs; Tab1..Tab3 jump directly.
	NextTab key.Binding
	PrevTab key.Binding
	Tab1    key.Binding
	Tab2    key.Binding
	Tab3    key.Binding

	// Up / Down / Select / Back drive the (placeholder) page focus and, from
	// Step 3 on, the master-detail browser.
	Up     key.Binding
	Down   key.Binding
	Select key.Binding
	Back   key.Binding

	// Copy yanks the focused value to the system clipboard via OSC52.
	Copy key.Binding

	// Help toggles the short/full help bar; Quit exits the program.
	Help key.Binding
	Quit key.Binding
}

Map is the global key map. Page-local maps are layered on top in later steps; this set is what the app shell dispatches and what the help bar renders.

func Default

func Default() Map

Default returns the initial global key map. Bubble Tea v2 note: the space key is spelled "space" (not " "), so any future space binding must use that form.

func (Map) FullHelp

func (m Map) FullHelp() [][]key.Binding

FullHelp implements help.KeyMap for the shell keys: the tab-switch/help/quit column appended after the active page's own full-help columns.

func (Map) ShortHelp

func (m Map) ShortHelp() []key.Binding

ShortHelp implements help.KeyMap for the shell keys: the always-present tab/help/quit bindings shown at the tail of every page's help bar (and alone on a page that supplies no KeyMap, e.g. the placeholder). Page-specific bindings — movement, mutation, view toggles — are contributed per page by the active page's PageKeyMap and composed ahead of these.

type PageKeyMap

type PageKeyMap = help.KeyMap

PageKeyMap is the help.KeyMap a page exposes so the help bar can render the bindings relevant to the current page and context, layered on top of the global shell keys. It is the substrate the adaptive help bar (#681) is built on, and the seam future adaptive hints (#683) and configurable keys (#675) plug into: a page reports its bindings data-driven, gated by capability and focus, and the shell composes them with the always-present shell keys.

Jump to

Keyboard shortcuts

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