[BUG] Prompt discarded when /<command> <prompt><space> triggers autocomplete
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?
There is a critical issue where the CLI fails to capture the user's prompt if the input buffer ends with a trailing space. This happens across all commands (built-in and plugin-installed).
When a user types a command and a prompt, then ends with a space (e.g., '/<command> <user_prompt><space>'), the UI activates the autocomplete/suggestion menu. If the user presses Enter while this menu is active:
The entire user prompt is discarded.
The CLI executes only the base command.
The discarded prompt is not saved to history (Up Arrow only shows the base command).
This makes it extremely easy to accidentally lose long, complex prompts simply by hitting the spacebar before hitting Enter.
This is a high-priority UX issue as it leads to immediate data loss of long prompts which cannot be recovered via command history.
What Should Happen?
The CLI should prioritize the content of the text buffer over the autocomplete suggestion menu when the Enter key is pressed.
Input Preservation: When Enter is pressed, the entire string in the input field—including the <user_prompt>—should be passed to the command as arguments, regardless of whether a trailing space has triggered the autocomplete dropdown.
History Persistence: The full string (command + prompt) should be saved to the command history so that it can be retrieved using the Up Arrow (^).
UI Dismissal: Pressing Enter should simply dismiss the autocomplete menu and execute the currently typed text, rather than letting the menu "intercept" the keystroke and reset the input to the base command.
In short: The autocomplete menu should be a helpful guide, not a "gatekeeper" that wipes out typed text if it stays open during execution.
Error Messages/Logs
Steps to Reproduce
- Type
/<plugin-command> some prompt(with a space at the end). - Note the autocomplete dropdown appearing.
- Press Enter.
- Result: Command runs without "some prompt" and input is lost.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.0.71
Platform
AWS Bedrock
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
I've tested it on other terminals (e.g. Mac default terminal) and I was able to reproduce the same issue.
The input buffer seems to be "cleansed" or "reset" to the base command prefix the moment the autocomplete menu is invoked, rather than treating the typed prompt as a separate string of arguments.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗