Skip to content

fix(ui): restore cursor and autowrap when install/migrate aborts#290

Merged
indaco merged 1 commit intomainfrom
fix/restore-terminal-state-on-panic
May 7, 2026
Merged

fix(ui): restore cursor and autowrap when install/migrate aborts#290
indaco merged 1 commit intomainfrom
fix/restore-terminal-state-on-panic

Conversation

@indaco
Copy link
Copy Markdown
Owner

@indaco indaco commented May 7, 2026

Description

Today, an early return or a panic between MultiProgress.init and its paired finish leaves the terminal with autowrap disabled and the cursor hidden until the user runs reset or stty sane. The visible cost is small but the surprise is real, since it can outlive the failing command.

This wires two complementary safety nets so the terminal is always handed back in a usable state:

  • The install download phase now anchors MultiProgress.finish to scope exit, matching what migrate already does. Any error path or --quiet/dry-run early return between init and the worker join restores the cursor, instead of relying on the explicit call at the bottom of the block.
  • A panic wrapper restores the same state before aborting. Defers do not run on panic, so a safety check tripping mid-install would otherwise still leak the DECRESET; this is the only path that closes that gap.

Related Issue

  • None

Notes for Reviewers

  • The release binary grows ~16 KB to make the panic wrapper possible (FullPanic over simple_panic);

Anchor MultiProgress.finish to scope exit on the install path and route
panic through a wrapper that restores the cursor + autowrap before abort.
Without this, an early return or panic between init and join leaves the
terminal in DECRESET until the user runs `reset` or `stty sane`.
@indaco indaco merged commit 1a3a990 into main May 7, 2026
3 checks passed
@indaco indaco deleted the fix/restore-terminal-state-on-panic branch May 7, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant