Commit 266a733

Eric Bower  ·  2026-07-31 10:35:17 -0400 EDT
parent fa93c35
fix(switch): reset screen and pass shell to next daemon
1 files changed,  +5, -0
+5, -0
 1@@ -1347,6 +1347,10 @@ fn attach(gpa: std.mem.Allocator, io: std.Io, daemon: *Daemon) !void {
 2         .detach => return,
 3         .switch_session => {
 4             if (looper.session_name) |session_name| {
 5+                // Reset terminal modes when switching sessions
 6+                const restore_seq = "\x1bc";
 7+                _ = lib_posix.write(lib_posix.STDOUT_FILENO, restore_seq) catch {};
 8+
 9                 var cwd_buf: [std.fs.max_path_bytes]u8 = undefined;
10                 const cwd_len = std.process.currentPath(io, &cwd_buf) catch 0;
11                 const cwd = cwd_buf[0..cwd_len];
12@@ -1365,6 +1369,7 @@ fn attach(gpa: std.mem.Allocator, io: std.Io, daemon: *Daemon) !void {
13 
14                 var target_daemon = Daemon.init(io, daemon.cfg, session_name, target_path);
15                 target_daemon.cwd = cwd;
16+                target_daemon.shell = daemon.shell;
17                 return attach(gpa, io, &target_daemon);
18             }
19         },