Skip to content

#1777: minimal implementation.#1848

Open
PratyushChauhan wants to merge 2 commits intopingdotgg:mainfrom
PratyushChauhan:terminal-style-history
Open

#1777: minimal implementation.#1848
PratyushChauhan wants to merge 2 commits intopingdotgg:mainfrom
PratyushChauhan:terminal-style-history

Conversation

@PratyushChauhan
Copy link
Copy Markdown

@PratyushChauhan PratyushChauhan commented Apr 9, 2026

closes #1777

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
2026-04-09.13-28-24.mp4

Note

Low Risk
Small, UI-only keyboard handling change scoped to the chat composer; main risk is unexpected interaction with existing arrow-key behavior in edge cases (cursor position/newlines/menu state).

Overview
Adds shell-style input history navigation to the chat composer in ChatView.tsx.

The composer now builds a per-thread history of previously sent user prompts, saves the current draft when entering history, and lets ArrowUp/ArrowDown cycle through entries (single-line only). On send, the trimmed prompt is prepended to history and the history index resets.

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

Note

Add ArrowUp/ArrowDown input history navigation to the chat composer

  • The chat composer in ChatView.tsx now tracks a per-thread input history, seeded from the thread's prior user messages on thread switch.
  • Pressing ArrowUp at the first line recalls older prompts; ArrowDown at the last line moves forward and restores the in-progress draft when exiting history mode.
  • Sending a message pushes the trimmed prompt to the front of the history and resets the history index.

Macroscope summarized 069183c.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 9, 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: 799896b2-0970-4a86-8bb9-a3fe809370a8

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 9, 2026
@PratyushChauhan
Copy link
Copy Markdown
Author

PratyushChauhan commented Apr 9, 2026

closed previous PR due to merge conflicts. #1778

@Marve10s
Copy link
Copy Markdown
Contributor

Marve10s commented Apr 9, 2026

Oh, I've wanted this for so long , I was planning to put up a PR for it. Any help or testing needed? I can test on different OS.

@PratyushChauhan
Copy link
Copy Markdown
Author

@Marve10s Thanks, that would be helpful!

@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp bot commented Apr 9, 2026

Approvability

Verdict: Needs human review

This PR adds a new user-facing feature (terminal-style input history navigation) and has an unresolved high-severity review comment identifying a potential bug where the wrong message could be sent due to stale promptRef state. Both the new feature nature and the substantive bug concern warrant human review.

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

if (key === 'ArrowUp' && inputHistoryRef.current.length > 0 && !promptRef.current.includes('\n')) {
if (historyIdxRef.current === -1) historyDraftRef.current = promptRef.current;
historyIdxRef.current = Math.min(historyIdxRef.current + 1, inputHistoryRef.current.length - 1);
setPrompt(inputHistoryRef.current[historyIdxRef.current]!);
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.

History navigation doesn't synchronously update promptRef

High Severity

The composer's new history navigation updates the prompt state but not promptRef.current synchronously. This leaves promptRef.current stale, causing onSend to potentially send the wrong message and the ArrowUp multiline guard to misbehave.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 375ee94. Configure here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

this does not happen during testing.

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 069183c. Configure here.

description: toastCopy.description,
});
}
if (promptForSend.trim()) { inputHistoryRef.current.unshift(promptForSend.trim()); historyIdxRef.current = -1; }
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.

History index not reset on early-return send paths

Low Severity

The plan-follow-up path and standalone-slash-command path both clear the prompt and return early from onSend, never reaching the historyIdxRef.current = -1 reset at line 3192. If the user was navigating history before triggering either path, historyIdxRef remains positive, so a subsequent ArrowDown would unexpectedly restore a history entry instead of behaving as normal cursor movement.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 069183c. Configure here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

cant produce any buggy interactions with slash commands.

@MatthewFeroz
Copy link
Copy Markdown

This is a great feature, would save me some time

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.

[Feature]: [UX] Terminal style history for chat input text field.

3 participants