Skip to content

feat: implement terminal style chat history#1778

Open
PratyushChauhan wants to merge 5 commits intopingdotgg:mainfrom
PratyushChauhan:main
Open

feat: implement terminal style chat history#1778
PratyushChauhan wants to merge 5 commits intopingdotgg:mainfrom
PratyushChauhan:main

Conversation

@PratyushChauhan
Copy link
Copy Markdown

@PratyushChauhan PratyushChauhan commented Apr 6, 2026

What Changed

Pressing / in the composer input navigates through previously sent user messages, shell-style. The live draft is saved when you first press and restored when you back past the most recent message. History index resets on send.

Why

Retyping or slightly tweaking a previous prompt is a common workflow. Every terminal does this — it's muscle memory. The composer already had the full message history available; this just wires / into onComposerCommandKey (where Enter/Tab/menu-navigation already live) using two refs. No new files, no new state, no re-renders.

UI Changes

No visual changes — interaction only. Navigation only activates when no autocomplete menu is open, so @-mention and /-command menus are unaffected.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Note

Low Risk
Low risk UI-only keyboard interaction change scoped to the chat composer; primary risk is minor UX regressions or conflicts with existing menu navigation.

Overview
Adds terminal-style prompt history navigation to the chat composer: ArrowUp cycles through previously sent user messages and ArrowDown moves back toward the live draft, restoring the saved draft when returning to index -1.

Introduces historyIndexRef/savedDraftRef to track history without new state, and resets this history whenever the composer is cleared (thread change, send, plan follow-up submission, or standalone slash command).

Reviewed by Cursor Bugbot for commit 7387819. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add terminal-style chat history navigation to the composer

  • Pressing ArrowUp in the composer cycles through prior user messages in the active thread (most recent first); ArrowDown navigates back toward the live draft.
  • On first entry into history mode, the current draft is saved to savedDraftRef and restored when navigating back to index -1.
  • After each send (including plan follow-up and slash command flows), the history pointer resets to -1 and the saved draft is cleared.
  • Changes are contained in ChatView.tsx.

Macroscope summarized 7387819.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 6, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c8cf2d7d-3883-4b73-a34d-be0de1bcc3f8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Apr 6, 2026
@PratyushChauhan
Copy link
Copy Markdown
Author

Video:

2026-04-06.14-55-36.mp4

setComposerCursor(next.length);
return true;
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ArrowUp unconditionally overrides multi-line cursor navigation

Medium Severity

The ArrowUp/ArrowDown history navigation activates unconditionally whenever user messages exist, with no check for cursor position or whether the prompt is multi-line. Since the composer supports multi-line input via Shift+Enter, pressing ArrowUp in a multi-line draft replaces the entire text with a historical message instead of moving the cursor up within the text. The handler is registered at COMMAND_PRIORITY_HIGH and calls event.preventDefault(), completely blocking normal Lexical cursor movement.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a068222. Configure here.

- Clear navigation history when resetting the local composer state
- Drop any saved draft so a new thread starts clean
@github-actions github-actions bot added size:M 30-99 changed lines (additions + deletions). and removed size:S 10-29 changed lines (additions + deletions). labels Apr 6, 2026
- Unify ArrowUp/ArrowDown prompt history handling in ChatView
- Preserve draft restoration when leaving history mode
@github-actions github-actions bot added size:S 10-29 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Apr 6, 2026
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp bot commented Apr 6, 2026

Approvability

Verdict: Needs human review

This PR adds a new user-facing feature (terminal-style history navigation) that changes keyboard handling behavior. Additionally, an unresolved review comment identifies a bug where the implementation breaks normal cursor navigation in multi-line prompts. Human review recommended to address the identified issue before merging.

You can customize Macroscope's approvability policy. Learn more.

- Clear prompt history state when sending a plan or slash command
- Prevent stale draft restoration after submission
Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit cd7686d. Configure here.

- Recompute the composer trigger after loading the next draft
- Keeps autocomplete state in sync with the restored prompt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant