shortcuts

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package shortcuts is the keyboard shortcuts view: a scrollable box over the grid listing every key by what it does, in two columns when the screen is wide enough. The rows come from the host, which builds them from the key bindings and the command registry. It knows the UI only through Host.

Index

Constants

View Source
const ID = "shortcuts"

ID identifies the view's box in mouse events.

Variables

This section is empty.

Functions

This section is empty.

Types

type Host

type Host interface {
	Theme() *theme.Theme
	Size() (width, height int)
	// Close closes the open overlay.
	Close()
	// Shortcuts are the rows to list, in order.
	Shortcuts() []Row
}

Host is what the shortcuts view needs of the UI.

type Row

type Row struct {
	Heading string
	Keys    []string // as shown, e.g. "Ctrl+G"
	Action  string
}

Row is a line of the view: a group heading, or keys and what they do.

type View

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

View is the open shortcuts view.

func New

func New(h Host) *View

New returns the view scrolled to the top.

func (*View) Indicator

func (s *View) Indicator() string

func (*View) Key

func (s *View) Key(k tea.KeyPressMsg) tea.Cmd

func (*View) Layout

func (s *View) Layout() []overlay.Box

func (*View) Lines

func (s *View) Lines() ([]string, int)

Lines renders the rows, as one or two columns, and returns their width.

func (*View) Mouse

func (s *View) Mouse(e overlay.MouseEvent) tea.Cmd

func (*View) Status

func (s *View) Status() (string, string)

func (*View) Top

func (s *View) Top() int

Top is the first line shown.

Jump to

Keyboard shortcuts

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