Skip to content

feat(ui): add keyboard prompt navigation - #348

Open
thatdudealso wants to merge 3 commits into
superagent-ai:mainfrom
thatdudealso:fm/grok-prompt-nav-p1
Open

feat(ui): add keyboard prompt navigation#348
thatdudealso wants to merge 3 commits into
superagent-ai:mainfrom
thatdudealso:fm/grok-prompt-nav-p1

Conversation

@thatdudealso

@thatdudealso thatdudealso commented Jul 22, 2026

Copy link
Copy Markdown

Summary

  • Add read-only keyboard navigation through user prompts derived from existing transcript entries.
  • Bind Ctrl+P to previous prompt and Ctrl+N to next prompt through the raw input path, avoiding composer history recall.
  • Keep the transcript at the selected prompt while streaming and flash the target briefly.
  • Suppress streaming auto-follow while prompt review is active, clearing the review lock when the user returns to the bottom or sends a new message.
  • Keep Ctrl+P/Ctrl+N in exactly one handler so one keypress advances one prompt.

Testing

  • bun run format
  • bun run typecheck
  • bun run lint (passes with five pre-existing unrelated warnings)
  • bun test src/ui/prompt-navigation.test.ts (7 tests)
  • Manually verified in the real bun run dev TUI with a local streaming API stub: after sending two prompts, one Ctrl+P while the composer was focused moved to the previous prompt, left composer text unchanged, flashed the target, and later stream chunks did not return the view to the bottom.
  • Verified the prompt-navigation binding is installed only through prependInputHandler; the duplicate handleKey path is removed.
  • No GIF or upstream merge performed.

Closes #345


Note

Low Risk
Localized TUI scroll and input behavior with dedicated tests; no auth, API, or data-path changes.

Overview
Adds read-only transcript navigation between user prompts with Ctrl+P (previous) and Ctrl+N (next), documented in the README.

Bindings are handled via prependInputHandler on raw input so they do not fight composer history or normal arrow keys. A small prompt-navigation helper derives user-message indices from chat entries and picks the nearest scroll anchor without wrapping.

While you are reviewing a prompt, streaming auto-follow is paused until you scroll back to the bottom, send a message, clear the session, or similar; the selected user message gets a brief accent flash. Unit tests cover index derivation, nearest-prompt lookup, and key mapping.

Reviewed by Cursor Bugbot for commit 3f62622. Configure here.

@open-cla

open-cla Bot commented Jul 22, 2026

Copy link
Copy Markdown

Contributor License Agreement

All contributors are covered by a CLA.

Comment thread src/ui/app.tsx
Comment thread src/ui/app.tsx
@thatdudealso

Copy link
Copy Markdown
Author

bugbot run

Comment thread src/ui/app.tsx
@thatdudealso

Copy link
Copy Markdown
Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 3f62622. Configure here.

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.

[Feature]: Prompt navigation - jump to previous/next user prompt

1 participant