Expand description
Canonical keyboard command model and focus-graph semantics for panes (bd-21pbi.1).
This module defines a host-agnostic keyboard interaction contract for
the pane workspace: a normative command vocabulary (PaneCommand), a
deterministic focus graph over the split tree (in-order traversal and
spatial/directional navigation with explicit tie-breaks), a pure command
resolver (resolve) that maps each command to a focus change, a list of
structural PaneOperations, or a transient view-state change, plus
explicit repeat/acceleration (PaneCommandAcceleration) and keymap
precedence (PaneKeymapPrecedence) policies.
Why a command layer? Pointer drag-resize already has a first-class semantic
pipeline (PaneSemanticInputEvent -> PaneDragResizeMachine ->
PaneTree::operations_for_transition). Keyboard interaction needs an
equivalent, but its vocabulary is broader than resize (focus navigation,
split/close/move/swap, maximize/restore) and must NOT be expressed as
host-specific key events. PaneCommand is that vocabulary: terminal
(bd-21pbi.2) and web (bd-21pbi.3) hosts translate raw key events into
PaneCommands, and resolve turns each command into the same outcome on
every host. This is the executable form of the normative spec in
docs/spec/pane-keyboard-interaction.md.
Determinism guarantee: for a fixed split-tree topology, layout, and focus
context, resolve is a pure function. Equivalent command streams
therefore yield identical pane state (topology hash + active pane) across
hosts — the cross-host parity property the pane validation epic requires.
Structs§
- Pane
Accessibility Preferences - Host-agnostic accessibility preferences for pane interaction (bd-21pbi.5).
- Pane
Announcement - A concise, host-agnostic accessibility announcement for a pane state change.
The web host renders
textinto anaria-liveregion; the terminal host surfaces it via a status line / log hook. - Pane
Announcer - Coalescing announcer that keeps host live regions / status lines bounded and
non-spammy: the latest offered announcement wins (so a burst of resize/repeat
announcements collapses to one), and consecutive identical text is
suppressed. Hosts call
PaneAnnouncer::takeonce per render / live-region update. - Pane
Command Acceleration - Repeat-key acceleration policy for resize stepping. Explicit and testable:
the first
accelerate_after_repeatspresses usebase_units; sustained repeats escalate toaccelerated_units. - Pane
Command Resolution - The full result of resolving one
PaneCommand: the effect plus the resulting focus context the host should adopt. - Pane
Focus Context - Host-owned focus context consumed by
resolve. This is plain input data, not competing persistent state: hosts store the active/maximized pane wherever they like (e.g.WorkspaceSnapshot::active_pane_id) and pass a snapshot here.
Enums§
- Pane
Announcement Category - Category of a pane state-change announcement (for host channel routing and coalescing).
- Pane
Cardinal Direction - A cardinal direction for spatial focus and pane movement.
- Pane
Command - The canonical, host-agnostic pane keyboard command vocabulary.
- Pane
Command Effect - The concrete effect a resolved command produces. Focus changes and maximize
state are transient (no tree mutation); structural changes are a list of
PaneOperations the host applies viaPaneTree::apply_operation. - Pane
Command Noop Reason - Why a command resolved to a no-op.
- Pane
Focus Ordinal - Cyclic ordinal over the deterministic focus order.
- Pane
Keymap Owner - Who owns a key given its bindings and the active precedence policy.
- Pane
Keymap Precedence - Conflict precedence between application-level keymaps and the pane manager.
Functions§
- announce_
command - Generate a concise accessibility announcement for a resolved command.
- focus_
cyclic - The cyclic neighbour of
activeinfocus_order. ReturnsNonewhenactiveis absent from the order or the tree has fewer than two leaves. - focus_
directional - The nearest leaf to
activein a cardinal direction, using solved geometry. - focus_
edge - The extreme leaf in a cardinal direction (jump to edge). Returns the active leaf’s own id when it is already the extreme, so callers can treat that as a no-op.
- focus_
order - Deterministic focus order: leaves in topological depth-first order
(
firstchild beforesecondat every split). This is the canonical “tab order” and is independent of solved geometry, so it is stable for any layout area. - resolve
- Resolve a single
PaneCommandagainst the current tree, solved layout, and focus context. Pure and deterministic: identical inputs always yield an identicalPaneCommandResolution, which is what makes equivalent command streams produce identical pane state across hosts.