keymap-demo

command
v0.57.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

keymap-demo is the reference interactive demo for the toolkit Action + Keymap layer driven from a terminal. A single toolkit.ActionRegistry and toolkit.Keymap are the one source of truth: the same Actions feed the menu shortcut hints, the command palette, and the keyboard bindings.

It demonstrates, live in the terminal, the four behaviours the layer exists to provide:

  • accelerators: Ctrl+S runs "Save" (a modifier chord parsed from the key stream);
  • multi-stroke chords: "g" then "d" runs "GoToDef" (the PENDING row shows the half-typed chord between strokes);
  • scopes: "a" runs "AllItems" globally, but with the widget scope active (toggled with Tab) it runs "AllText" instead — the widget binding shadows the global one;
  • hot rebinding: "r" rebinds "GoToDef" to "z" at run time; the menu hint updates and "z" then runs it.

The screen is a fixed grid of labelled rows so its state is trivially assertable cell-by-cell:

row 0  keymap-demo (q quits)
row 2  MENU Save[Ctrl+S] Open[Ctrl+O] GoToDef[G D] Find[/]
row 4  SCOPE=global
row 6  PENDING=
row 8  LAST=none
row 10 MSG=
row 12 PALETTE ...

Jump to

Keyboard shortcuts

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