summaryrefslogtreecommitdiff
path: root/src/dump.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/dump.zig')
-rw-r--r--src/dump.zig11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/dump.zig b/src/dump.zig
index 153e4a82..6bdfb7d4 100644
--- a/src/dump.zig
+++ b/src/dump.zig
@@ -13,7 +13,6 @@ const config = @import("config.zig");
const pdf_enabled = pardes.pdf_enabled;
const platform = pardes.platform;
const isolated = pardes.isolated;
-const terminal_panes = pardes.terminal_panes;
const MAX_PANES = pardes.MAX_PANES;
const MAX_COLS = pardes.MAX_COLS;
const effect_path_cap = pardes.effect_path_cap;
@@ -73,7 +72,7 @@ test "two dumps in one second get names of their own" {
try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "pardes-x.dump", .data = "" });
try std.testing.expect(std.mem.endsWith(u8, uniqueIn(&buf, dir, "pardes-x").?, "/pardes-x-2.dump"));
}
-/// The host's environment; a freestanding core (web, the board) has none
+/// The host's environment; a freestanding core (the web's) has none
/// and no libc to ask, so only a DumpDir with no `~/` names a directory there.
fn hostEnv(name: [*:0]const u8) ?[*:0]u8 {
if (builtin.os.tag == .freestanding) return null;
@@ -91,7 +90,7 @@ pub fn directory(buf: []u8, dir_setting: []const u8) ?[]const u8 {
var fba_buf: [4096]u8 = undefined;
var fba = std.heap.FixedBufferAllocator.init(&fba_buf);
var cwd_buf: [1024]u8 = undefined;
- // No libc on the web or the board: there a relative one is from `/`.
+ // No libc on the web: there a relative one is from `/`.
const cwd: []const u8 = if (comptime !pardes.hosted) "/" else if (std.fs.path.isAbsolute(raw)) "/" else if (std.c.getcwd(&cwd_buf, cwd_buf.len)) |c| std.mem.span(@as([*:0]const u8, @ptrCast(c))) else "/";
const resolved = std.fs.path.resolvePosix(fba.allocator(), &.{ cwd, raw }) catch return null;
return std.fmt.bufPrint(buf, "{s}", .{resolved}) catch null;
@@ -471,7 +470,7 @@ fn revivePane(p: *Pardes, id: usize, pane: *pardes.panes.Pane, was_on_disk: bool
pane.command_done = true;
return;
}
- if (comptime !(terminal_panes and platform != .web and !isolated)) return;
+ if (comptime platform == .web or isolated) return;
if (pane.cwdSlice().len > effect_path_cap) return;
pardes.panes.terminal.reviveShell(pane);
p.emitSpawn(id, pane.serial, pane.cwdSlice());
@@ -663,7 +662,7 @@ test "a pane restored with unsaved text is asked about by Exit, Restore, Del and
}
test "a loaded terminal's history stays above its banner, the cursor where it was" {
- if (comptime !pardes.panes.terminal.enabled or isolated) return error.SkipZigTest;
+ if (comptime isolated) return error.SkipZigTest;
const gpa = std.testing.allocator;
const term = pardes.panes.terminal;
const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 40, .rows = 12 });
@@ -684,7 +683,7 @@ test "a loaded terminal's history stays above its banner, the cursor where it wa
}
test "an upgraded session's dump keeps its views and its running terminal as they were, and settings the startup config would change" {
- if (comptime !pardes.panes.terminal.enabled or isolated) return error.SkipZigTest;
+ if (comptime isolated) return error.SkipZigTest;
const gpa = std.testing.allocator;
const term = pardes.panes.terminal;
const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 40, .rows = 12, .startup_config = "Verbose off\n" });