Skip to content

tui: always restore the terminal on early exit#15671

Merged
etraut-openai merged 1 commit intomainfrom
etraut/tui-app-server-terminal-restore
Mar 24, 2026
Merged

tui: always restore the terminal on early exit#15671
etraut-openai merged 1 commit intomainfrom
etraut/tui-app-server-terminal-restore

Conversation

@etraut-openai
Copy link
Copy Markdown
Collaborator

@etraut-openai etraut-openai commented Mar 24, 2026

Summary

Fixes early TUI exit paths that could leave the terminal in a dirty state and cause a stray % prompt marker after the app quit.

Root cause

Both tui and tui_app_server had early returns after tui::init() that did not guarantee terminal restore. When that happened, shells like zsh inherited the altered terminal state.

Changes

  • Add a restore guard around run_ratatui_app() in both tui and tui_app_server
  • Route early exits through the guard instead of relying on scattered manual restore calls
  • Ensure terminal restore still happens on normal shutdown

@fcoury
Copy link
Copy Markdown
Contributor

fcoury commented Mar 24, 2026

@etraut-openai LGTM!

@etraut-openai etraut-openai merged commit 989e513 into main Mar 24, 2026
60 of 62 checks passed
@etraut-openai etraut-openai deleted the etraut/tui-app-server-terminal-restore branch March 24, 2026 20:29
@github-actions github-actions bot locked and limited conversation to collaborators Mar 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants