summaryrefslogtreecommitdiff
path: root/src/Core.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/Core.zig')
-rw-r--r--src/Core.zig36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/Core.zig b/src/Core.zig
index ee4420ec..7c550d74 100644
--- a/src/Core.zig
+++ b/src/Core.zig
@@ -526,7 +526,17 @@ fn initSession(gpa: std.mem.Allocator, opts: Options) !*Pardes {
p.boot = Boot.of(opts);
// Asked once, at the start, whoever asks first after.
_ = p.sessionDir();
- switch (p.boot) {
+ // A core built without a terminal (a test configuration: core-test's)
+ // boots to a scratch pane where a shell would have been, and says why
+ // once.
+ const shell_boot = switch (p.boot) {
+ .tty, .tty_shell, .shell, .classic => true,
+ .document, .missing, .stdin => false,
+ };
+ if (pardes.Term.ops == null and shell_boot) {
+ _ = try pardes.panes.newScratch(p, 0, 0, .scratch);
+ p.oneColumn();
+ } else switch (p.boot) {
.document => {
const path = opts.file.?;
const opened = initial_doc: {
@@ -2309,6 +2319,7 @@ test "topbar hover highlights exactly the executable word" {
}
test "pane-tag Exec prefers Term and argument builtins before shell fallback" {
+ if (pardes.Term.ops == null) return error.SkipZigTest; // a shell
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{ .cols = 100, .rows = 30 });
defer p.deinit();
@@ -2531,6 +2542,7 @@ test "Filter is ordered after Del and toggles only its terminal or +Pager pane"
}
test "compact tag commands stay beside their own prefix across layout changes" {
+ if (pardes.Term.ops == null) return error.SkipZigTest; // a shell
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{ .cols = 100, .rows = 30 });
defer p.deinit();
@@ -2575,6 +2587,7 @@ test "compact tag commands stay beside their own prefix across layout changes" {
}
test "Term spawns a raw shell in the caller's directory" {
+ if (pardes.Term.ops == null) return error.SkipZigTest; // a shell
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 100, .rows = 30 });
defer p.deinit();
@@ -2600,6 +2613,7 @@ test "Term spawns a raw shell in the caller's directory" {
}
test "a terminal respawned into a closed pane's slot hangs the old shell up first" {
+ if (pardes.Term.ops == null) return error.SkipZigTest; // a shell
// Hosts keep a shell per slot: were the spawn first, the close would
// end the new shell and leave the old one running.
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 30 });
@@ -2670,6 +2684,7 @@ test "an empty column shows its theme's empty_col under its tag: acme's white, e
}
test "unknown Exec from a document runs as a command pane in its directory, typed into no terminal" {
+ if (pardes.Term.ops == null) return error.SkipZigTest; // a command pane
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{});
defer p.deinit();
@@ -2697,6 +2712,7 @@ test "unknown Exec from a document runs as a command pane in its directory, type
}
test "Exec in a terminal whose tty is taken runs as a command pane instead of typing at the program" {
+ if (pardes.Term.ops == null) return error.SkipZigTest; // a command pane
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{});
defer p.deinit();
@@ -2728,6 +2744,7 @@ test "Exec in a terminal whose tty is taken runs as a command pane instead of ty
}
test "a command of several lines keeps its tag one row, and its echo does not staircase" {
+ if (pardes.Term.ops == null) return error.SkipZigTest; // a command pane
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 100, .rows = 30 });
defer p.deinit();
@@ -2754,6 +2771,7 @@ test "a command of several lines keeps its tag one row, and its echo does not st
}
test "a spawn is for the pane it was made for, not whatever took the slot since" {
+ if (pardes.Term.ops == null) return error.SkipZigTest; // a command pane
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{ .tty_only = true });
defer p.deinit();
@@ -2784,6 +2802,7 @@ test "a spawn is for the pane it was made for, not whatever took the slot since"
}
test "a REPL bound for a language takes the exec made on a body in it; tags, Exec by name and command words still run" {
+ if (pardes.Term.ops == null) return error.SkipZigTest; // the classic boot's three shells
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{ .shells = 3, .cols = 100, .rows = 30 });
defer p.deinit();
@@ -3024,6 +3043,7 @@ test "a restored terminal's tag names neither the REPL it was nor the shell it h
}
test "a Term started by a shell's path keeps the path in its Term+ word" {
+ if (pardes.Term.ops == null) return error.SkipZigTest; // a shell
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true });
defer p.deinit();
while (p.nextEffect()) |_| {}
@@ -3034,6 +3054,7 @@ test "a Term started by a shell's path keeps the path in its Term+ word" {
}
test "Tty, Term's old name in saved tags, runs as Term, bare and with its +shell" {
+ if (pardes.Term.ops == null) return error.SkipZigTest; // a shell
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true });
defer p.deinit();
while (p.nextEffect()) |_| {}
@@ -3046,6 +3067,7 @@ test "Tty, Term's old name in saved tags, runs as Term, bare and with its +shell
}
test "Term+fish, one word a tag can hold, opens a terminal on that shell" {
+ if (pardes.Term.ops == null) return error.SkipZigTest; // a shell
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true });
defer p.deinit();
while (p.nextEffect()) |_| {}
@@ -3075,6 +3097,7 @@ test "Term+fish, one word a tag can hold, opens a terminal on that shell" {
}
test "a command pane shows how its command ended, and the next command there runs below it" {
+ if (pardes.Term.ops == null) return error.SkipZigTest; // a command pane
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{});
defer p.deinit();
@@ -3173,6 +3196,7 @@ test "a command pane shows how its command ended, and the next command there run
}
test "a terminal its program gave back takes command lines again" {
+ if (pardes.Term.ops == null) return error.SkipZigTest; // a command pane
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{});
defer p.deinit();
@@ -3206,6 +3230,7 @@ test "a terminal its program gave back takes command lines again" {
}
test "the host is asked about a tty only where a command line is about to go" {
+ if (pardes.Term.ops == null) return error.SkipZigTest; // the classic boot's three shells
const p = try Pardes.init(std.testing.allocator, .{ .shells = 3, .cols = 100, .rows = 30 });
defer p.deinit();
while (p.nextEffect()) |_| {}
@@ -3369,6 +3394,7 @@ test "startup config overrides restored styling before initFromDump returns" {
}
test "restored terminals keep monotonic nonzero pane identities" {
+ if (pardes.Term.ops == null) return error.SkipZigTest; // the classic boot's three shells
const gpa = std.testing.allocator;
const source = try Pardes.init(gpa, .{ .shells = 3 });
defer source.deinit();
@@ -3663,6 +3689,7 @@ test "argv naming nothing boots an errors pane rather than failing the launch" {
}
test "raw terminal cursor obeys visibility without hiding modal and tag cursors" {
+ if (pardes.Term.ops == null) return error.SkipZigTest; // a shell
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 40, .rows = 12 });
defer p.deinit();
@@ -3707,6 +3734,7 @@ test "raw terminal cursor obeys visibility without hiding modal and tag cursors"
}
test "raw terminal cursor follows its active row only while that row is visible" {
+ if (pardes.Term.ops == null) return error.SkipZigTest; // a shell
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 40, .rows = 12 });
defer p.deinit();
@@ -3736,6 +3764,7 @@ test "raw terminal cursor follows its active row only while that row is visible"
}
test "the bare tty startup opens a text pane under the shell, unfocused" {
+ if (pardes.Term.ops == null) return error.SkipZigTest; // a shell
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .boot = .tty });
defer p.deinit();
try std.testing.expectEqual(Boot.tty, p.boot);
@@ -3804,6 +3833,7 @@ test "tty output follows only from the bottom" {
}
test "an unasked desktop paste reaches a tty pane's program, not its buffer" {
+ if (pardes.Term.ops == null) return error.SkipZigTest; // a shell
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24 });
defer p.deinit();
@@ -3822,6 +3852,7 @@ test "an unasked desktop paste reaches a tty pane's program, not its buffer" {
}
test "a paste larger than the effect ring reaches the program whole and in order" {
+ if (pardes.Term.ops == null) return error.SkipZigTest; // a shell
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24 });
defer p.deinit();
@@ -3856,6 +3887,7 @@ test "bytes for a terminal past what may wait for it are dropped and said, never
}
test "a bracketed paste larger than the ring still closes its bracket" {
+ if (pardes.Term.ops == null) return error.SkipZigTest; // a shell
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24 });
defer p.deinit();
@@ -3878,6 +3910,7 @@ test "a bracketed paste larger than the ring still closes its bracket" {
}
test "a terminal's answer to its program waits behind the paste still queued for its pty" {
+ if (pardes.Term.ops == null) return error.SkipZigTest; // a shell
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24 });
defer p.deinit();
@@ -3904,6 +3937,7 @@ test "a terminal's answer to its program waits behind the paste still queued for
}
test "pasted bytes still queued at shutdown are freed, not leaked" {
+ if (pardes.Term.ops == null) return error.SkipZigTest; // a shell
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24 });
defer p.deinit();