Skip to content

feat(tui): Phase 4 — sticky prompt headers#100

Merged
davidrhodus merged 1 commit into
mainfrom
tui-phase4
Jul 16, 2026
Merged

feat(tui): Phase 4 — sticky prompt headers#100
davidrhodus merged 1 commit into
mainfrom
tui-phase4

Conversation

@davidrhodus

Copy link
Copy Markdown
Contributor

Continues the grok-inspired TUI work (Phases 1–3 on main). Scroll up through a long tool output and the prompt that section belongs to now pins to the top of the transcript — so you never lose track of which request you're reading output for.

╭ hi · pipe · glm-5.2 ─────────────────────────────────────╮
│❯ refactor the tokenizer                                  │   ← pinned
│  tokenizer output line 20                                │
│  tokenizer output line 21                                │
│  tokenizer output line 22                                │
╰──────────────────────────────────────────────── ↓ 41 new ╯

How

  • TranscriptEntry::UserPrompt(Line) — a structurally-distinct entry (vs a plain Line) so the render pass can find prompt boundaries. flatten/text treat it like a Line; push_user_prompt records it; run.rs's two prompt echoes route through it.
  • The render does one measuring pass building per-line wrapped-height prefix sums — yielding both the exact total (as before) and each prompt's wrapped-row offset. When scrolled (not following) past a prompt, the most recent prompt strictly above the viewport top is overlaid on the top inner row, with a subtle band (truecolor) marking it as pinned. No sticky while following (bottom-pinned).
  • wrapped_height became a #[cfg(test)] helper (the render path sums the new per-line function inline); its overflow-saturation regression test stays.

Scope / deferred

Bounded, no render-model rewrite. Still deferred to a future pass (each needs a block cursor / live-streaming blocks / a new engine): per-block selection folding, the running accent-wave animation, mouse selection, and a real markdown/syntect engine.

Verification

153 hi-tui tests pass (new screen-dump test: pinned when scrolled past, absent while following); cargo fmt --all + full-workspace clippy -D warnings clean; ratchet updated. Ran the CI gate set locally this time (fmt --all, ratchet, full clippy, hi tests) to avoid the round-trips Phase 3 hit.

🤖 Generated with Claude Code

When you scroll up through a long tool output, the prompt that section
belongs to now pins to the top of the transcript, so you never lose track
of which request you're reading the output for (grok's sticky-header nav).

- lib.rs: a structurally-distinct TranscriptEntry::UserPrompt(Line) so the
  render pass can find prompt boundaries (flatten/text treat it like a
  Line; push_user_prompt records it; run.rs's two prompt echoes use it).
- render.rs: one measuring pass builds per-line wrapped-height prefix sums
  — giving both the exact total (as before) and each prompt's wrapped-row
  offset. When scrolled (not following) past a prompt, the most recent
  prompt strictly above the viewport top is overlaid on the top inner row,
  with a subtle band (truecolor) marking it as pinned. wrapped_height is
  now a #[cfg(test)] helper (its overflow-saturation regression stays).

Verified with a screen-dump test: pinned when scrolled past, absent while
following. Deferred still (need a block cursor / live blocks / a markdown
engine): per-block selection folding, the running accent-wave, mouse
selection, a real markdown/syntect engine.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@davidrhodus
davidrhodus merged commit d5d6211 into main Jul 16, 2026
1 check passed
@davidrhodus
davidrhodus deleted the tui-phase4 branch July 16, 2026 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant