Commit 1b62815

Eric Bower  ·  2026-04-28 22:14:52 -0400 EDT
parent 5389d30
refactor(attach): reset outer terminal to default state

Closes: https://github.com/neurosnap/zmx/issues/106
1 files changed,  +1, -11
+1, -11
......@@ -1809,17 +1809,7 @@ fn attach(daemon: *Daemon) !void {
18091809 _ = cross.c.tcsetattr(posix.STDIN_FILENO, cross.c.TCSAFLUSH, &orig_termios);
18101810 }
18111811 // Reset terminal modes on detach:
1812- // - Mouse: 1000=basic, 1002=button-event, 1003=any-event, 1006=SGR extended
1813- // - 2004=bracketed paste, 1004=focus events, 1049=alt screen
1814- // - 25h=show cursor
1815- // NOTE: We intentionally do NOT clear screen or home cursor here because we dont
1816- // want to corrupt any programs that rely on it including ghostty's session restore.
1817- const restore_seq = "\x1b[?1000l\x1b[?1002l\x1b[?1003l\x1b[?1006l" ++
1818- "\x1b[?2004l\x1b[?1004l\x1b[?1049l" ++
1819- // Restore pre-attach Kitty keyboard protocol mode so Ctrl combos
1820- // return to legacy encoding in the user's outer shell.
1821- "\x1b[<u" ++
1822- "\x1b[?25h";
1812+ const restore_seq = "\x1bc";
18231813 _ = posix.write(posix.STDOUT_FILENO, restore_seq) catch {};
18241814 }
18251815