fix: restore enhanced keyboard modes on PTY teardown - #235
Merged
Conversation
Reset leaked Kitty keyboard stacks and flags on both sides of alternate-screen teardown, and disable the xterm modifyOtherKeys fallback through one shared best-effort writer used by normal and forced cleanup. Add exact-byte, idempotency, and failure-tolerance tests plus a documented real-terminal validation procedure and the outer-TUI preservation limitation. Refs #234
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.
Summary
Restore the local terminal's ordinary keyboard input mode after an interactive PTY session ends while a remote application has left enhanced keyboard reporting enabled.
What changed
TerminalStateGuard::Dropandforce_terminal_cleanup().modifyOtherKeysalongside the Kitty protocol reset.Test plan
cargo test --lib pty::terminal::tests::cargo test --test pty_integration_testcargo fmt --all -- --checkcargo clippy --all-targets --all-features -- -D warningsgit diff --checkKnown limitation
Cleanup restores the ordinary shell baseline rather than an enhanced keyboard mode owned by an outer local TUI. Crossterm 0.29 exposes support detection but not the active flag value; adding a custom
/dev/ttyquery would introduce blocking and input-reader races and is intentionally not part of this teardown fix. Exact state preservation is tracked in #236.Closes #234