Skip to content

Conversation

@daniel-lxs
Copy link
Member

@daniel-lxs daniel-lxs commented Jun 14, 2025

This PR fixes the issue where up/down arrows would load old prompts instead of moving the cursor when editing multi-line text.

Changes:

  • Up arrow only triggers history navigation when cursor is at the beginning of text
  • Added Alt+Up/Down for explicit history navigation at any cursor position
  • Down arrow in history mode works intelligently at both beginning and end of text
  • History navigation resets when user types to avoid accidental loads
  • Extracted prompt history logic into dedicated usePromptHistory hook

The default behavior now allows normal text editing with arrow keys, while still providing convenient access to prompt history when needed.

Fixes #4669


Important

Improves prompt history navigation in ChatTextArea.tsx by using a new usePromptHistory hook and refining arrow key behavior.

  • Behavior:
    • Up arrow triggers history navigation only at text start; Alt+Up/Down for navigation at any position.
    • Down arrow in history mode works at both text start and end.
    • History navigation resets on typing to prevent accidental loads.
  • Hooks:
    • Extracted prompt history logic into usePromptHistory hook in usePromptHistory.ts.
  • Misc:
    • Removed cursor positioning logic from ChatTextArea.tsx to simplify code.

This description was created by Ellipsis for 23483f9. You can customize this summary. It will automatically update as commits are pushed.

…ting

- Only trigger history navigation when cursor is at the beginning (up arrow)
- Add explicit Alt+Up/Down for history navigation at any cursor position
- Smart navigation in history mode: down arrow works at beginning or end
- Properly handle cursor positioning when navigating through history
- Reset navigation state when user types to avoid accidental history loads
- Extract prompt history logic into dedicated usePromptHistory hook

This addresses the issue where up/down arrows would load old prompts instead
of moving the cursor when editing multi-line text.
@daniel-lxs daniel-lxs requested review from cte, jr and mrubens as code owners June 14, 2025 01:56
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Jun 14, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jun 14, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Review] in Roo Code Roadmap Jun 14, 2025
@mrubens mrubens merged commit 91f632e into main Jun 14, 2025
24 of 25 checks passed
@mrubens mrubens deleted the fix/smart-prompt-history-navigation branch June 14, 2025 02:10
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jun 14, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Jun 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer PR - Needs Review size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Up/down do not work in prompt box

4 participants