Problem
Terminal setup, suspend, resume, and teardown return early on individual failures. A runtime error or panic can leave raw mode, alternate-screen, mouse capture, focus tracking, bracketed paste, or the cursor in the wrong state after GridBash exits.
Acceptance checks
- Cleanup attempts every restoration operation even if an earlier one fails.
- Partial setup failures roll back completed terminal changes.
- Panics restore the terminal before the error is printed.
- Focused tests cover cleanup ordering and error preservation where practical.
Problem
Terminal setup, suspend, resume, and teardown return early on individual failures. A runtime error or panic can leave raw mode, alternate-screen, mouse capture, focus tracking, bracketed paste, or the cursor in the wrong state after GridBash exits.
Acceptance checks