Ctrl+K (clear input) is adjacent to Ctrl+J (newline) — easy to accidentally wipe prompt

Resolved 💬 3 comments Opened May 17, 2026 by ron-wand Closed May 21, 2026

Problem

Ctrl+K clears the current input line, and Ctrl+J submits (newline/enter). These are adjacent keys, making it easy to accidentally clear a long prompt you were composing — with no undo.

Why it matters

  • No undo for cleared input
  • Ctrl+K is a standard readline binding for "kill to end of line" (not "clear screen"), so the current behavior is also inconsistent with readline expectations
  • Risk is higher when typing quickly or on keyboards where K and J are close

Suggested fix

Either:

  1. Remap Ctrl+K to its standard readline meaning (kill to end of line, not full clear), or
  2. Add an undo buffer (Ctrl+Z or Ctrl+_) to restore the last cleared input, or
  3. Require a confirmation or a less common key combo for the destructive clear action

Environment

Claude Code CLI

View original on GitHub ↗

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