Repository navigation
Conversation
|
alecuba16
force-pushed
the
fix/terminal-restore-sigint-kitty-pop
branch
from
October 9, 2026 08:12
24f25e3 to
af8e737
Compare
alecuba16
force-pushed
the
fix/terminal-restore-sigint-kitty-pop
branch
from
October 9, 2026 12:37
bce08bd to
624defc
Compare
alecuba16
force-pushed
the
fix/terminal-restore-sigint-kitty-pop
branch
from
October 9, 2026 17:14
cf361f5 to
67f65d2
Compare
alecuba16
force-pushed
the
fix/terminal-restore-sigint-kitty-pop
branch
from
October 9, 2026 18:18
67f65d2 to
05d8200
Compare
The SIGINT/SIGTERM/SIGHUP/SIGQUIT handler restored raw mode, the primary screen and the cursor but never popped the kitty keyboard stack nor disabled bracketed paste, focus reporting or mouse capture, so a signal exit left the shell echoing raw sequences like e1;1:3u. The cleanup now disables every TUI mode and pops the kitty stack, writing the disable sequences to stdout where setup_terminal armed them, and skips the pop when this process owns no stack entry. Ownership is tracked process-wide, set on enable, adopted when an exec handoff inherits the previous process's entry, and the push, ownership flip and signal cleanup serialize under one mutex so termination waits out an in-flight push/pop instead of exiting with the entry active. While an editor owns the tty the cleanup leaves terminal modes alone, and the editor handoff publishes only after suspend finished and reclaims before resume re-arms, both under the kitty state lock, so the cleanup never sees a half-applied handoff. Terminal-mode tests pin the skip, single-pop and no-test-bytes-on-stdout semantics, and the editor test child waits on a sentinel the sampler writes once it observes ownership instead of a fixed sleep. Closes 1jehuang#1635. Related 1jehuang#898.
alecuba16
force-pushed
the
fix/terminal-restore-sigint-kitty-pop
branch
from
October 9, 2026 19:17
05d8200 to
9217b68
Compare
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.
Closes #1635. Related #898.
The signal handler (SIGINT/SIGTERM/SIGHUP/SIGQUIT) restored raw mode, the primary screen and the cursor but never popped the kitty keyboard stack nor disabled bracketed paste, focus reporting or mouse capture. A signal exit could therefore leave the terminal in CSI u mode and the shell echoed raw sequences like
e1;1:3u.The handler now disables every TUI mode and calls
disable_keyboard_enhancement()before exiting. The pop is a no-op on terminals with no kitty stack, so it is safe unconditionally. This is the signal-exit path; #898 covers the same leak on the normal-exit path inside tmux.Also one-line
..Default::default()fix in provider_setup to keep a struct literal compiling after new fields.11 insertions, no behavior change on the normal-exit path. Single commit rebased onto current master.