summaryrefslogtreecommitdiff
path: root/src/exec.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/exec.zig')
-rw-r--r--src/exec.zig50
1 files changed, 1 insertions, 49 deletions
diff --git a/src/exec.zig b/src/exec.zig
index 221de105..8c062f66 100644
--- a/src/exec.zig
+++ b/src/exec.zig
@@ -870,58 +870,10 @@ pub fn applyStartupConfig(p: *Pardes) void {
defer p.announce = true;
var lines = std.mem.splitScalar(u8, p.opts.startup_config orelse return, '\n');
while (lines.next()) |line| {
- if (executeBuiltinLine(p, p.active, line)) continue;
- // A setting pardes no longer has is said, once, and changes nothing.
- const word = commandText(line);
- const head = word[0 .. std.mem.indexOfAny(u8, word, " \t") orelse word.len];
- if (std.mem.eql(u8, head, "ColumnTags"))
- p.setMessage(p.active, "ColumnTags: column tags are always shown now; the init line is ignored");
- // A word renamed runs as its new name, and says so, once a line.
- for ([_][2][]const u8{ .{ "ThemeSel", "Themes" }, .{ "FontSel", "Fonts" } }) |renamed| if (std.mem.eql(u8, head, renamed[0])) {
- _ = executeBuiltinLine(p, p.active, renamed[1]);
- var said: [64]u8 = undefined;
- p.setMessage(p.active, std.fmt.bufPrint(&said, "{s}: renamed to {s}", .{ renamed[0], renamed[1] }) catch "renamed");
- };
+ _ = executeBuiltinLine(p, p.active, line);
}
}
-test "an init file's ThemeSel runs as Themes and says it was renamed" {
- const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 24, .startup_config = "ThemeSel\n" });
- defer p.deinit();
- var listed = false;
- for (p.panes) |slot| if (slot) |pane| if (pane.file) |f| if (f.output) |o| {
- listed = listed or std.meta.eql(o.from, panes.Output.Origin{ .cmd = .Themes });
- };
- try std.testing.expect(listed);
- // In the session's directory, not `/`.
- for (p.panes) |slot| if (slot) |pane| if (pane.file) |f| if (f.output != null)
- try std.testing.expectEqualStrings(p.sessionDir(), std.fs.path.dirname(f.path).?);
- var said = false;
- for (p.panes) |slot| if (slot) |pane| {
- said = said or std.mem.eql(u8, pane.msg[0..pane.msg_len], "ThemeSel: renamed to Themes");
- };
- try std.testing.expect(said);
- // The panes there at boot are the log's first records, before what the
- // init file said.
- const th = @import("ninep/testing.zig");
- const log = @intFromEnum(pardes.ctlfs.TopFile.log);
- const h = th.call(p, .{ .tag = 1, .op = .open, .node = log }).reply.handle;
- defer _ = th.call(p, .{ .tag = 3, .op = .release, .node = log, .handle = h });
- const text = th.call(p, .{ .tag = 2, .op = .read, .node = log, .handle = h, .size = 1 << 16 }).bytes;
- try std.testing.expectStringStartsWith(text, "new ");
-}
-
-test "an init file's retired ColumnTags line is said and ignored" {
- const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 24 });
- defer p.deinit();
- p.opts.startup_config = "ColumnTags\nWrap off\n";
- applyStartupConfig(p);
- try std.testing.expect(!p.settings.wrap);
- try std.testing.expect(p.columnBarHeight() > 0);
- const pane = p.panes[p.active].?;
- try std.testing.expectEqualStrings("ColumnTags: column tags are always shown now; the init line is ignored", pane.msg[0..pane.msg_len]);
-}
-
pub fn runBuiltin(p: *Pardes, b: Builtin, id: usize, txt: []const u8, arg: ?[]const u8) void {
runBuiltinFrom(p, b, id, txt, arg, false);
}