feat: preserve outer TUI keyboard state - #237
Merged
Merged
Conversation
Capture Kitty keyboard flags, xterm modifyOtherKeys, and alternate-screen ownership before starting the PTY input task. Preserve unrelated input bytes and restore the captured state across normal and forced cleanup while retaining the legacy baseline fallback. Track remote screen transitions so an unchanged outer alternate buffer is not cleared during teardown. Refs #236
Publish the captured terminal protocol state before bracketed-paste setup can fail, allowing outer forced cleanup to restore it even when guard construction returns an error. Keep the private protocol snapshot on TerminalStateGuard so the public TerminalState struct remains source-compatible. Refs #236
Trust terminal query replies only before each transaction's first primary DA sentinel, preserve all untrusted bytes, and discard incomplete snapshots. Capture Kitty flags independently on both screen buffers with non-clearing DEC mode 47 transitions, normalize remote input without popping outer stacks, and restore both screens during teardown. Enforce single raw-terminal ownership so concurrent guards cannot race the global snapshot. Refs #236
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
modifyOtherKeysand DEC private mode 1049, in DA-delimited transactions bounded to 100 ms per screen before the PTY input reader starts.1049hwhen bssh began inside an outer alternate-screen TUI.Test plan
cargo test --lib(1,280 passed, 9 ignored)cargo test --test pty_integration_test(18 passed)cargo clippy --all-targets --all-features -- -D warningscargo fmt --all -- --checkgit diff --checkCloses #236