[BUG] VS Code: Up Arrow overwrites unsent prompts with history, causing potential data loss
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
The Claude Code VS Code extension's native graphical sidebar has a potentially destructive keyboard-navigation behavior that can cause the loss of unfinished prompts.
When composing a multiline prompt, pressing the Up Arrow key normally moves the cursor upward through the text. However, once the cursor reaches the first line, pressing Up Arrow again unexpectedly replaces the entire unfinished prompt with a previously submitted prompt from conversation history.
This is particularly frustrating when composing lengthy, detailed prompts. A single accidental extra Up Arrow keystroke can replace several minutes of work.
Recovery Is Unreliable
- Pressing Down Arrow sometimes restores the unfinished prompt.
- However, this recovery is inconsistent. I have experienced situations where the original prompt could not be recovered.
- Pressing Cmd+Z (Undo) does not restore the overwritten prompt.
- There is no apparent setting to disable Up Arrow history navigation.
This behavior occurs during ordinary text editing, without any explicit intention to navigate prompt history.
The primary concern is that normal cursor navigation can unexpectedly replace unsent text, and the user has no reliable mechanism to recover it.
What Should Happen?
The Up Arrow key should perform normal cursor navigation when the prompt editor contains unsent text.
Expected behavior:
- Pressing Up Arrow should move the cursor upward through the existing prompt.
- Once the cursor reaches the beginning of the prompt, additional Up Arrow presses should leave the cursor at the beginning without modifying the text.
- Prompt-history navigation should not activate while unsent text exists in the input field.
- If history navigation is available, it should require a separate keyboard shortcut or only activate when the input field is empty.
- Any unfinished prompt should always be preserved and recoverable.
- Cmd+Z (Undo) should restore the original prompt if history navigation replaces the input.
Preferred Solution
Disable Up Arrow history navigation whenever the input field contains unsent text.
Alternatively, provide a configurable setting that allows users to disable history navigation entirely.
For example, a proposed setting might be:
claudeCode.enableArrowKeyHistoryNavigation
This is a suggested configuration option, not an existing setting.
The goal is to preserve standard text-editing behavior while preventing accidental loss of unfinished prompts.
Error Messages/Logs
No error messages are displayed. The issue occurs entirely within the graphical prompt editor and does not produce any visible errors or warnings. The unfinished prompt is silently replaced with a previously submitted prompt.
Steps to Reproduce
- Open Visual Studio Code with the official Anthropic Claude Code extension installed.
- Open the native graphical Claude Code sidebar (not the integrated terminal).
- Start or open a conversation containing at least one previously submitted prompt.
- Begin composing a new multiline prompt containing several paragraphs of text.
- Position the cursor somewhere within the unfinished prompt.
- Repeatedly press Up Arrow to navigate toward the beginning of the text.
- Once the cursor reaches the first line, press Up Arrow again.
- Observe that the entire unfinished prompt is replaced with a previously submitted prompt from conversation history.
- Press Down Arrow to attempt to recover the unfinished prompt.
- Repeat the process and observe that recovery is not consistently reliable.
- If the unfinished prompt cannot be restored, press Cmd+Z (Undo).
- Observe that Undo does not restore the original text.
Reproduction Notes
- This occurs in the native Claude Code VS Code sidebar.
- The behavior does not require any particular project, repository, or source code.
- The problem occurs during normal multiline prompt composition.
- The history-navigation behavior is reproducible.
- The inconsistent recovery behavior has been observed but is not reliably reproducible on every attempt.
Claude Model
Not sure / Multiple models
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.300 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
VS Code integrated terminal
Additional Information
I am using Claude Code for VS Code v2.1.299
Claude Code version 2.1.300
The problem appears in all aspect of Claude: VSC Extension, MacOS application, Web (claude.ai), and CLI version.
The up-arrow should not work on draft or newly written prompts or text in the prompt box. It should only work on an empty prompt box or when viewing a previously submitted prompt.
The down-arrow restore previous prompt is fantastically flaky and unreliable and when working fast and hitting too many up-arrows - you lose your work. ARGGGHH!!