Skip to content

Fit modal key hints to narrow terminals and add a key overlay #281

Open

Description

@hakula139

Summary

Every modal footer joins its hints into one string and truncates it at the terminal edge (render_footer in tui/modal/chrome.rs, about ten call sites). On a narrow terminal the cut can land mid-hint ("Ctrl+A for arc"), and the hints that get dropped are whichever come last, whether or not they matter. The /resume footer also mixes key hints with status (the session count, "more not loaded", the scope), so status text takes up room the keys need.

Design

  • Structured hints. A hint is a key plus a label plus a priority, and is taken from the same named-action table that Archive and unarchive sessions from the /resume picker #280 introduces for the /resume picker. Status such as counts and scope stays separate from key hints and gets its own place, for example a right-aligned segment or the header description.
  • Fit whole hints by priority. Render as many whole hints as fit, highest priority first, keeping them in their declared order. Never cut a hint in the middle. When any are dropped, end the row with a hint for the key overlay, such as ? keys. At very narrow widths, fall back to each action's short label.
  • Key overlay. One key opens an overlay listing every action in the current context with its key and full label, generated from the action table. Pickers with a filter need a key that cannot collide with filter input: ? while the filter is empty, or another key verified against the line editor's bindings.
  • Hint style. Every hint renders as Key label, with the key in bold text and the label in muted, and hints are joined by ·. Each key has one spelling everywhere: Esc, Enter, Tab, Ctrl+End, ↑ / ↓. Today the approval prompt writes [Y] approve [N] deny, pickers write Enter to confirm · Esc to cancel, and the jump-to-bottom pill writes (ctrl+End) while the welcome tip says Ctrl+End. Every footer paints in dim, so keys and labels carry equal weight. Codex renders footer keys in bold and their labels dimmed (codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__approval_overlay__tests__network_exec_prompt.snap).
  • Rejected alternatives. A scrolling marquee moves under the reader's eye, can't be read mid-scroll, and keeps the screen redrawing. Wrapping hints onto extra rows makes the layout jump when the terminal is resized.

Acceptance criteria

  • All modal footers, plus the approval prompt and the chat input hints, render structured hints through one fitting routine, and no hint is cut mid-word at any width.
  • Hints keep their declared order, and lower-priority hints are dropped first. Whenever a hint is hidden, the row ends with a pointer to the key overlay.
  • The key overlay lists every action available in the current context, generated from the same table that dispatches the keys.
  • Status text in the /resume footer no longer competes with key hints for the row.
  • Every hint, including the status bar's interrupt hint and the jump-to-bottom pill, uses the shared style and one spelling per key, and a style test pins the key and label styles.
  • Render tests cover a wide, a medium, and a very narrow width for at least the /resume picker and the approval prompt.
  • This builds on Archive and unarchive sessions from the /resume picker #280's action table, and Customize TUI key bindings #278 rebinds keys through the same table, so hints always show the bound key.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area: tuienhancement

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions