[BUG] Ctrl+G during Ctrl+R prompt search doesn't select prompt, edits lost

Resolved 💬 3 comments Opened Jan 6, 2026 by hjtenklooster Closed Feb 21, 2026

Bug Description

When using Ctrl+R to search prompt history and pressing Ctrl+G to edit the highlighted prompt in an external editor, edits made in the editor are lost upon return.

Steps to Reproduce

  1. Have at least one previous prompt in history
  2. Press Ctrl+R to enter prompt search mode
  3. Type a search term that matches a previous prompt (e.g., "te")
  4. A matching prompt is highlighted
  5. Press Ctrl+G directly (without pressing Tab to select first)
  6. External editor (neovim) opens with the full matched prompt content
  7. Edit the prompt in the editor
  8. Save and exit (:wq)
  9. Return to Claude Code

Expected Behavior

The edited prompt should appear in the input field.

Actual Behavior

Claude Code is still in search mode (search prompts: te visible). Edits are lost.

Workaround

Press Tab to select the prompt before pressing Ctrl+G.

Suggested Fix

When Ctrl+G is pressed during search mode with a highlighted prompt, auto-select that prompt first (equivalent to pressing Tab), then open the external editor.

Environment

  • Platform: macOS (darwin)
  • Terminal: Ghostty
  • Version: 2.0.76

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗