Files
codewhale/crates/tui
Hunter Bown 18b797b593 feat(tui): #133 wire Esc-Esc backtrack into UI and live transcript
Connects the new BacktrackState to the live UI:

- App: holds a `backtrack: BacktrackState` and a new
  `truncate_history_to(new_len)` helper that keeps `tool_cells`,
  `tool_details_by_cell`, and the sub-agent card index consistent.
- live_transcript: gains a `Mode::BacktrackPreview { selected_idx }`
  that highlights the Nth-from-tail HistoryCell::User with a `▶` marker
  and reverse-video styling. Cache stays valid across mode flips —
  decoration is applied post-wrap. Left/Right/Enter/Esc emit new
  `ViewEvent::Backtrack{Step,Confirm,Cancel}` events.
- ui.rs: routes Esc through `BacktrackState::handle_esc` only when
  no popup is open and not streaming, opens the preview overlay on
  the second Esc, and on confirm trims `app.history` /
  `app.api_messages` and refills the composer with the dropped user
  input. Streaming and existing popup paths preserve their original
  Esc behaviour.
- keybindings: documents the `Esc Esc` chord in the help catalog.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 00:26:21 -05:00
..