Repository navigation
fix(editor): restore the terminal promptly on quit - #278
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
:qcould leave the editor visibly frozen while command history, recovery snapshots, plugin hooks, and external services finished shutting down. Local macOS PTY measurements put the original clean-quit screen transition at 39.3 ms median, with a 210 ms outlier. Recovery writes must remain durable, but they do not need to keep the alternate screen visible.What changed
scripts/quit_bench.py.The final local measurements were 0.605 ms median / 1.092 ms maximum for clean quit, and 0.593 ms median / 1.086 ms maximum across 30 forced quits. Full process exit still waits for cleanup. These measurements used isolated configuration with AI/LSP disabled; they are not a physical-display or network-service latency guarantee. Full methodology and results are in
docs/performance-quit-latency-2026-08-18.md.How to Test
cargo build --locked --release --bin red.python3 scripts/quit_bench.py --binary target/release/red --runs 10. Expect one alternate-screen restore, normal terminal flags, persisted quit history, and separate screen/process timings.python3 scripts/quit_bench.py --binary target/release/red --dirty --runs 5. Expect ordinary:qto refuse unsaved changes,:q!to restore the terminal, the source file to remain unchanged, and the recovery snapshot to contain the edit.--storage-updates 200and--preference-kib 8192. Expect plugin state and command history to survive without delaying the screen transition until the writes finish.Validated at
68c769c: 2,844 Rust tests passed, one ignored, strict all-targets/all-features Clippy passed, and the retained tmux clean/rejected/forced-quit walkthrough passed. Focused regressions includeinteractive_shutdown_restores_and_persists_before_waiting_for_agent,interactive_shutdown_persists_even_when_terminal_restore_fails, and the accepted/rejected quit-history tests.