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
| ... | ... | @@ -1347,6 +1347,10 @@ fn attach(gpa: std.mem.Allocator, io: std.Io, daemon: *Daemon) !void { | |
| 1347 | 1347 | .detach => return, | |
| 1348 | 1348 | .switch_session => { | |
| 1349 | 1349 | if (looper.session_name) |session_name| { | |
| 1350 | + | // Reset terminal modes when switching sessions | |
| 1351 | + | const restore_seq = "\x1bc"; | |
| 1352 | + | _ = lib_posix.write(lib_posix.STDOUT_FILENO, restore_seq) catch {}; | |
| 1353 | + | ||
| 1350 | 1354 | var cwd_buf: [std.fs.max_path_bytes]u8 = undefined; | |
| 1351 | 1355 | const cwd_len = std.process.currentPath(io, &cwd_buf) catch 0; | |
| 1352 | 1356 | const cwd = cwd_buf[0..cwd_len]; |
| ... | ... | @@ -1365,6 +1369,7 @@ fn attach(gpa: std.mem.Allocator, io: std.Io, daemon: *Daemon) !void { | |
| 1365 | 1369 | ||
| 1366 | 1370 | var target_daemon = Daemon.init(io, daemon.cfg, session_name, target_path); | |
| 1367 | 1371 | target_daemon.cwd = cwd; | |
| 1372 | + | target_daemon.shell = daemon.shell; | |
| 1368 | 1373 | return attach(gpa, io, &target_daemon); | |
| 1369 | 1374 | } | |
| 1370 | 1375 | }, |