Skip to content

Conversation

@Aaronontheweb
Copy link
Owner

Summary

Fixes #44 - Terminal state not fully cleaned up on application exit.

Ensure terminal is fully restored when Termina application exits by adding missing cleanup steps to RunAsync() finally block:

  • DisableMouse() - turn off mouse tracking if enabled
  • ResetColors() - emit \x1b[0m to reset text attributes
  • Flush() - actually send buffered ANSI commands to terminal
  • Console.WriteLine() - clear any partial line artifacts

Before

Users had to manually reset terminal state after Termina shutdown:

Console.Write("\x1b[?25h\x1b[0m");
Console.WriteLine();
Console.ResetColor();

After

Terminal state is automatically restored - no manual cleanup needed.

Test plan

  • All 561 existing tests pass
  • Manual test: Run demo app, exit with Ctrl+Q, verify no artifacts
  • Manual test: Run demo app, exit with Ctrl+C, verify no artifacts

Ensure terminal is fully restored when Termina application exits:
- DisableMouse() to turn off mouse tracking if enabled
- ResetColors() to emit \x1b[0m and reset text attributes
- Flush() to actually send buffered ANSI commands
- Console.WriteLine() to clear any partial line artifacts

This prevents visual artifacts and inconsistent terminal state after
Termina applications exit.

Fixes #44
@Aaronontheweb Aaronontheweb enabled auto-merge (squash) December 16, 2025 20:53
@Aaronontheweb Aaronontheweb merged commit 8081a07 into dev Dec 16, 2025
7 checks passed
@Aaronontheweb Aaronontheweb deleted the feature/terminal-cleanup-on-exit branch December 16, 2025 20:54
@Aaronontheweb Aaronontheweb mentioned this pull request Dec 16, 2025
6 tasks
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.

Terminal state not fully cleaned up on application exit

2 participants