From 6dcacb15c53b2f032a573ed10e39777bc281a481 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 13:52:09 -0300 Subject: A Tty started by a shell's path keeps the path in its Tty+ word The tag said Tty+, so a click on it looked the bare name up on the usual paths and found nothing, or another program. A shell given as a path now keeps the path in the word. Co-Authored-By: Claude Opus 5.5 --- src/pardes.zig | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/pardes.zig b/src/pardes.zig index ae04b4e7..d5935302 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -1826,6 +1826,16 @@ test "a restored terminal's tag names neither the REPL it was nor the shell it h try std.testing.expect(std.mem.indexOf(u8, shown, "Tty+fish") == null); } +test "a Tty started by a shell's path keeps the path in its Tty+ word" { + const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true }); + defer p.deinit(); + while (p.nextEffect()) |_| {} + try std.testing.expect(p.executeBuiltinLine(0, "Tty /bin/sh")); + try std.testing.expect(p.active != 0); + p.acknowledgeShell(p.active, "/bin/sh", false); + try std.testing.expect(std.mem.startsWith(u8, tagline.curTail(p.panes[p.active].?), " Tty+/bin/sh ")); +} + test "Tty+fish, one word a tag can hold, opens a terminal on that shell" { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true }); defer p.deinit(); @@ -5179,7 +5189,9 @@ pub const Pardes = struct { // The tag's Tty word names the shell the host ran, and a click // on it (`Tty+fish`) opens another of the same. if (pane.command == null) { - const base = std.fs.path.basename(executable); + // A shell given as a path keeps it: its bare name would find + // nothing, or another program, on the usual paths. + const base = if (pane.shell) |given| (if (std.mem.indexOfScalar(u8, given, '/') != null) given else std.fs.path.basename(executable)) else std.fs.path.basename(executable); const rest = tagline.terminal_pane_tail[" Tty".len..]; if (std.fmt.bufPrint(&pane.shell_tail, " Tty+{s}{s}", .{ base, rest })) |tail| { pane.shell_tail_len = @intCast(tail.len); -- cgit v1.3