Command history navigation truncates draft input — saves only first few lines, loses the rest

Resolved 💬 3 comments Opened Mar 11, 2026 by arbind Closed Mar 14, 2026

Problem

When typing a long, multi-line message in the Claude Code CLI and pressing the down arrow key, the command history navigation activates. The current draft input is partially saved — the first couple of lines are preserved, but the majority of the message is silently lost. There is no way to recover the truncated content.

This is worse than losing the entire draft, because the user may not immediately realize content was lost — they see the beginning of their message and assume it's intact.

Steps to reproduce

  1. Start typing a detailed, multi-line message in the Claude Code input (5+ lines)
  2. Press the down arrow key (e.g., intending to navigate within the text, or by accident)
  3. Command history navigation activates
  4. Navigate back — only the first ~2 lines of the original draft are restored
  5. The remaining content is permanently lost

Expected behavior

If the CLI saves draft input during history navigation, it should save the complete input buffer, not a truncated version. The full draft should be recoverable when navigating back.

Impact

Users composing complex, detailed prompts lose the bulk of their work to an accidental keypress. The partial save makes it worse — it's easy to miss that content was truncated until after submitting, resulting in incomplete instructions to Claude and wasted time. This discourages writing detailed, high-quality prompts in the CLI.

Suggested fix

  • Ensure the full input buffer (all lines) is stashed when history navigation is triggered, not just the first N lines
  • Restore the complete draft when the user navigates back to the bottom of history
  • Consider a /recall command or Ctrl+Z to recover the last stashed draft as a safety net

Environment

  • macOS (Darwin 24.6.0)
  • Claude Code CLI

View original on GitHub ↗

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