Ctrl+Z suspend wipes undo buffer, making accidental deletions unrecoverable

Resolved 💬 2 comments Opened Apr 10, 2026 by tow Closed May 24, 2026

Summary

Suspending Claude Code with Ctrl+Z and resuming with fg completely wipes the input undo buffer. This means the most natural recovery instinct after an accidental destructive edit (e.g. Ctrl+K deleting a long prompt) actually destroys the only way to recover it.

Steps to reproduce

  1. Start typing a long prompt (1000+ chars)
  2. Accidentally press Ctrl+K (kills to end of line), deleting most of your input
  3. Instinctively press Ctrl+Z to undo — but this suspends Claude Code instead
  4. Type fg to resume Claude Code
  5. Press Ctrl+_ (the actual undo binding) — nothing happens, undo history is gone

Expected behavior

  • The undo buffer should survive SIGTSTP/SIGCONT (suspend/resume)
  • After fg, Ctrl+_ should still be able to undo prior edits

Actual behavior

The undo buffer is completely wiped on resume. The text deleted by Ctrl+K is permanently lost.

Why this is particularly painful

Ctrl+Z is the universal undo shortcut in virtually every other text editor. When a user accidentally destroys input, muscle memory fires Ctrl+Z before conscious thought kicks in. In Claude Code, this has the perverse effect of:

  1. Not undoing the destructive edit (because Ctrl+Z suspends instead)
  2. Destroying the undo history that could have recovered it (because suspend/resume wipes the buffer)

So the instinct to recover from a mistake actively makes the mistake unrecoverable.

Additional notes

  • Related issues: #8626, #6298, #3195, #12483

Environment

  • macOS (Darwin 24.6.0)
  • zsh

View original on GitHub ↗

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