summaryrefslogtreecommitdiff
path: root/src/pardes.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 13:52:09 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commit6dcacb15c53b2f032a573ed10e39777bc281a481 (patch)
treeea56dc38d48f41e7d38bea0bf4330342ab2a7a9f /src/pardes.zig
parentcb2beaf76c07e74c76297082b9d43be3122bd55a (diff)
downloadpardes-6dcacb15c53b2f032a573ed10e39777bc281a481.tar.gz
pardes-6dcacb15c53b2f032a573ed10e39777bc281a481.zip
A Tty started by a shell's path keeps the path in its Tty+ word
The tag said Tty+<basename>, 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 <[email protected]>
Diffstat (limited to 'src/pardes.zig')
-rw-r--r--src/pardes.zig14
1 files changed, 13 insertions, 1 deletions
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);