- commit
- 1b62815
- parent
- 5389d30
- author
- Eric Bower
- date
- 2026-04-28 22:14:52 -0400 EDT
refactor(attach): reset outer terminal to default state Closes: https://github.com/neurosnap/zmx/issues/106
1 files changed,
+1,
-11
+1,
-11
1@@ -1809,17 +1809,7 @@ fn attach(daemon: *Daemon) !void {
2 _ = cross.c.tcsetattr(posix.STDIN_FILENO, cross.c.TCSAFLUSH, &orig_termios);
3 }
4 // Reset terminal modes on detach:
5- // - Mouse: 1000=basic, 1002=button-event, 1003=any-event, 1006=SGR extended
6- // - 2004=bracketed paste, 1004=focus events, 1049=alt screen
7- // - 25h=show cursor
8- // NOTE: We intentionally do NOT clear screen or home cursor here because we dont
9- // want to corrupt any programs that rely on it including ghostty's session restore.
10- const restore_seq = "\x1b[?1000l\x1b[?1002l\x1b[?1003l\x1b[?1006l" ++
11- "\x1b[?2004l\x1b[?1004l\x1b[?1049l" ++
12- // Restore pre-attach Kitty keyboard protocol mode so Ctrl combos
13- // return to legacy encoding in the user's outer shell.
14- "\x1b[<u" ++
15- "\x1b[?25h";
16+ const restore_seq = "\x1bc";
17 _ = posix.write(posix.STDOUT_FILENO, restore_seq) catch {};
18 }
19