diff options
59 files changed, 165 insertions, 161 deletions
diff --git a/abi/pardes.h b/abi/pardes.h index 65ca5c60..ca65b8f3 100644 --- a/abi/pardes.h +++ b/abi/pardes.h @@ -191,7 +191,7 @@ typedef enum { PARDES_HAPTIC_LOOK = 2, } pardes_haptic_e; -// ---------------------------------------------------------------- runtime +// ---------------------------------------------------------------- callbacks // What the host lends the core. Three callbacks, because everything else the // core wants done it already does itself: it owns the ptys, and it opens URLs @@ -214,7 +214,7 @@ typedef struct { // pardes_paste, which may be synchronous inside this call. Main thread, // inside pardes_tick. void (*read_clipboard)(void *userdata); -} pardes_runtime_s; +} pardes_callbacks_s; // ---------------------------------------------------------------- lifecycle @@ -223,7 +223,7 @@ typedef struct { // core defers each shell's greeting until it has seen one), and the first // forkpty takes its winsize straight off the core — boot at 80x24 and the // shell draws its first prompt to a width the window never had. -int pardes_init(const pardes_runtime_s *runtime, uint16_t cols, uint16_t rows); +int pardes_init(const pardes_callbacks_s *runtime, uint16_t cols, uint16_t rows); void pardes_deinit(void); // Drain pty output into the core and perform the effects it queued. Call after diff --git a/core/Addon.zig b/core/Addon.zig index ec2f796a..0b60ca9c 100644 --- a/core/Addon.zig +++ b/core/Addon.zig @@ -911,7 +911,7 @@ test "addon reload gives migration the old record version and saves the new vers return if (version == 1 and n == 1 and bytes[0] == 7) Kind.c.PA_OK else 1; } }; - const p = try @import("ninep/testing.zig").withFile(std.testing.allocator, "x\n"); + const p = try @import("ninep/harness.zig").withFile(std.testing.allocator, "x\n"); defer p.deinit(); var old = std.mem.zeroInit(Kind.Ops, .{ .head = std.mem.zeroInit(Kind.c.pa_head, .{ .size = @sizeOf(Kind.c.pa_head), .abi = Kind.abi, .version = 1 }), .open = Fake.open, .paint = Fake.paint, .dump = Fake.save, .load = Fake.load }); @memcpy(old.head.name[0..7], "migrate"); diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index d4034ca0..9b551e9b 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -58,6 +58,10 @@ running no longer crashes now and then, freeing its own core while still answering it. +- The tag word `Unattach` is `Undock`: a +Search docked under the pane it + answers for leaves it with `Undock`, and stays where it is, a pane of its + own. *Attach* is a client joining a session now; `Unattach` is an + unknown word, with no alias. - The row after a file's last newline, where the cursor can sit and no line is yet, shows `~` in the gutter where its line number was, as helix's does. diff --git a/core/Core.zig b/core/Core.zig index d5a990e2..b109b073 100644 --- a/core/Core.zig +++ b/core/Core.zig @@ -288,7 +288,7 @@ session_home: [limits.host_path_cap]u8 = undefined, session_home_len: ?u16 = null, session_shell: [limits.host_path_cap]u8 = undefined, session_shell_len: u16 = 0, -settings: config.Runtime = .{ .font = .{ .tagline_percent = config.gui_tagline_font_percent } }, +settings: config.Settings = .{ .font = .{ .tagline_percent = config.gui_tagline_font_percent } }, locations_config: locations.Config = .{}, locations_cache: locations.Cache = .{}, tty_filter_palette: pardes.Term.FilterPalette = .{}, @@ -296,10 +296,10 @@ font_request_taken: bool = false, custom_theme: ?Theme = null, /// bodyChrome's: the theme it was worked out for, and it. body_chrome: ?struct { theme: Theme, chrome: ChromeTheme } = null, -theme_file_path: config.Runtime.Text(limits.host_path_cap) = .{}, +theme_file_path: config.Settings.Text(limits.host_path_cap) = .{}, /// The ThemeFile last loaded whole: what /ctl and DumpConfig name, and /// what a failed ThemeFile goes back to (colors.revertThemeFile). -theme_file_loaded: config.Runtime.Text(limits.host_path_cap) = .{}, +theme_file_loaded: config.Settings.Text(limits.host_path_cap) = .{}, theme_file_generation: u32 = 0, theme_file_pane: u8 = 0, chrome: colors.ChromeTheme = colors.initial_chrome, @@ -1102,7 +1102,7 @@ fn observeFontInner( p: *Pardes, effective_name: []const u8, effective_size_hundredths: u16, - unit: config.Runtime.FontSizeUnit, + unit: config.Settings.FontSizeUnit, ) bool { if (!p.settings.font.effective_name.set(effective_name)) return false; p.settings.font.effective_size_hundredths = effective_size_hundredths; @@ -1117,7 +1117,7 @@ fn acknowledgeFontInner( p: *Pardes, effective_name: []const u8, effective_size_hundredths: u16, - unit: config.Runtime.FontSizeUnit, + unit: config.Settings.FontSizeUnit, ) bool { if (!p.settings.font.pending or !p.font_request_taken) return false; const changed = !std.mem.eql( @@ -2945,7 +2945,7 @@ test "a REPL bound for a language takes the exec made on a body in it; tags, Exe // A body's click written back to event is done as the click: sent. A // line written to exec came back as F and runs as the command it was. { - const th = @import("ninep/testing.zig"); + const th = @import("ninep/harness.zig"); const event = ctlfs.Node.of(file.serial, .event); const h = th.call(p, .{ .tag = 1, .op = .open, .node = event }).reply.handle; defer _ = th.call(p, .{ .tag = 2, .op = .release, .node = event, .handle = h }); @@ -3039,7 +3039,7 @@ test "a REPL bound for a language takes the exec made on a body in it; tags, Exe try std.testing.expect(Sent.len[1] == 0 and file.prompt == .none); // The question is in the log, and a script answers it on the ctl. { - const th = @import("ninep/testing.zig"); + const th = @import("ninep/harness.zig"); _ = exec.executeFrom(p, 0, "print(5)", true); var want: [32]u8 = undefined; try std.testing.expect(th.logHas(p, try std.fmt.bufPrint(&want, "ask {d} repl a b\n", .{file.serial}))); @@ -3423,7 +3423,7 @@ test "Font keeps requested and acknowledged faces as separate plain state" { try std.testing.expect(!p.settings.font.pending); try std.testing.expectEqualStrings(installed[0].name, p.settings.font.effective_name.get()); try std.testing.expectEqual(@as(u16, 1375), p.settings.font.effective_size_hundredths); - try std.testing.expectEqual(config.Runtime.FontSizeUnit.pixels, p.settings.font.effective_size_unit); + try std.testing.expectEqual(config.Settings.FontSizeUnit.pixels, p.settings.font.effective_size_unit); try std.testing.expect(!p.acknowledgeFont("Duplicate Ack", 1400, .pixels)); try std.testing.expect(p.executeBuiltinLine(p.view().active, cmd)); @@ -3541,7 +3541,7 @@ test "Tab N draws every pane's tab N cells wide and clicks count past it; bare T try std.testing.expect(p.executeBuiltinLine(0, "Tab 0")); try std.testing.expectEqual(@as(u16, 8), p.settings.tab); // The ctl read's tab column, and a Dump's settings. - const ctl_text = @import("ninep/testing.zig").rd(p, ctlfs.Node.of(pane.serial, .ctl), 0, 4096).bytes; + const ctl_text = @import("ninep/harness.zig").rd(p, ctlfs.Node.of(pane.serial, .ctl), 0, 4096).bytes; try std.testing.expect(std.mem.indexOf(u8, ctl_text, " 8 ") != null); try dump.dumpState(p); const restored = try dump.restore(p, p.dump_out.?, "/tmp/pardes.dump.zon"); diff --git a/core/Dir.zig b/core/Dir.zig index a82887fb..29c5cdc8 100644 --- a/core/Dir.zig +++ b/core/Dir.zig @@ -430,7 +430,7 @@ test "an exec in a directory pane runs in its directory, and its +Errors goes th } test "over 9P a directory pane is a text pane whose name ends in /, its body the listing, ctl's isdir 1, and get reads it again" { - const th = @import("ninep/testing.zig"); + const th = @import("ninep/harness.zig"); const tree = @import("ninep/tree.zig"); var tmp = testing.tmpDir(.{}); defer tmp.cleanup(); diff --git a/core/Effect.zig b/core/Effect.zig index 7166294f..7475cc84 100644 --- a/core/Effect.zig +++ b/core/Effect.zig @@ -681,7 +681,7 @@ test "a save path that names no file is refused before anything is rewritten" { } test "a Save the host could not do logs no save record" { - const th = @import("ninep/testing.zig"); + const th = @import("ninep/harness.zig"); const p = try th.withFile(std.testing.allocator, "x\n"); defer p.deinit(); const Failing = struct { diff --git a/core/Handover.zig b/core/Handover.zig index bcf42c31..dde31f8b 100644 --- a/core/Handover.zig +++ b/core/Handover.zig @@ -165,7 +165,7 @@ pub fn finish(h: *Handover, p: *Pardes, seq: u32, to: []const u8, failure: ?[]co const pane = p.panes[id].?; if (pane.file == null or pane.file.?.revision != revision) { // Out of its group, or the owner's close would take it along. - pane.attached_to = null; + pane.docked_to = null; kept += 1; continue; } @@ -277,7 +277,7 @@ pub fn adopt(p: *Pardes, bytes: []const u8) !usize { for (st.owners, 0..) |owner, k| { const at = owner orelse continue; if (at >= n) continue; - p.panes[slots[k]].?.attached_to = p.panes[slots[at]].?.serial; + p.panes[slots[k]].?.docked_to = p.panes[slots[at]].?.serial; } const tc = layout.targetColumn(p, x); var heights: [MAX_PANES]u16 = @splat(0); diff --git a/core/Output.zig b/core/Output.zig index 3ac9f521..ab84ae35 100644 --- a/core/Output.zig +++ b/core/Output.zig @@ -705,7 +705,7 @@ pub fn openThemes(p: *Pardes, id: usize) !void { for (pardes.themes, 0..) |t, i| { if (pardes.colors.groupAt(i)) |title| try out.writer.print("{s}# {s}\n", .{ if (i == 0) "" else "\n", title }); - try out.writer.print(comptime config.Runtime.findAction(.theme).?.word ++ " {s}\n", .{t.name}); + try out.writer.print(comptime config.Settings.findAction(.theme).?.word ++ " {s}\n", .{t.name}); } const content = try out.toOwnedSlice(); try openStepped(p, id, .{ .cmd = .Themes }, content); @@ -716,7 +716,7 @@ pub fn isWalkRow(file: *const File.State, row: usize, line: []const u8) bool { if (usesLocationsConfig(state.from) or std.meta.eql(state.from, Origin{ .query = .callstack })) return isResultRow(file, row); if (!std.meta.eql(state.from, Origin{ .cmd = .Themes })) return true; // Section labels are for reading, not stops in the command walk. - return std.mem.startsWith(u8, std.mem.trimStart(u8, line, " \t"), comptime config.Runtime.findAction(.theme).?.word ++ " "); + return std.mem.startsWith(u8, std.mem.trimStart(u8, line, " \t"), comptime config.Settings.findAction(.theme).?.word ++ " "); } pub fn openFonts(p: *Pardes, id: usize) !void { @@ -733,7 +733,7 @@ fn fontsListed(gpa: std.mem.Allocator, arena: std.mem.Allocator) anyerror![]u8 { var out: std.Io.Writer.Allocating = .init(gpa); errdefer out.deinit(); for (fonts.list(arena, null)) |f| - try out.writer.print(comptime config.Runtime.findAction(.font).?.word ++ " {s}\n", .{f.name}); + try out.writer.print(comptime config.Settings.findAction(.font).?.word ++ " {s}\n", .{f.name}); return out.toOwnedSlice(); } @@ -852,7 +852,7 @@ pub fn openConfig(p: *Pardes, id: usize) !void { var located: std.Io.Writer.Allocating = .init(p.gpa); defer located.deinit(); try p.locations_config.write(&located.writer); - try config.Runtime.writeReport(&out.writer, .{ + try config.Settings.writeReport(&out.writer, .{ .locations = located.written(), .default_dump_dir = p.tape.authority(dumpDirectory, .{@as([]u8, &dir_buf)}), .startup_config_path = p.startupPath(), diff --git a/core/Query.zig b/core/Query.zig index dacc11a1..0cecb93e 100644 --- a/core/Query.zig +++ b/core/Query.zig @@ -200,16 +200,16 @@ fn freeSaved(gpa: std.mem.Allocator, s: Saved) void { gpa.free(s.items); } -/// The owner's query pane (attached to it, or left where it was by -/// Unattach): the one a later search from it reuses. +/// The owner's query pane (docked to it, or left where it was by +/// Undock): the one a later search from it reuses. pub fn ofOwner(p: *Pardes, owner_serial: u32) ?usize { var found: ?usize = null; for (p.panes, 0..) |slot, i| { const pane = slot orelse continue; const q = pane.query orelse continue; if (q.owner != owner_serial) continue; - // the attached one first: an unattached one is a kept result - if (pane.attached_to == owner_serial) return i; + // the docked one first: an undocked one is a kept result + if (pane.docked_to == owner_serial) return i; found = found orelse i; } return found; @@ -1754,7 +1754,7 @@ fn promote(p: *Pardes, qid: usize, id: usize) void { // Its text was read from that file to preview it (displayPreview). f.on_disk = filesystem.localPath(f.path) != null; f.syntax_dirty = true; - pane.attached_to = null; + pane.docked_to = null; if (f.on_disk) p.recent.opened(p.recentGpa(), f.path); if (filesystem.localPath(f.path) != null) p.emit(.{ .watch = .{ .pane = .at(id), .on = true } }); pardes.ctlfs.events.noteLog(p, .rename, pane); @@ -1887,7 +1887,7 @@ pub fn cancel(p: *Pardes, id: usize) void { // A preview made for the query Esc took back has no use: its rows // go to the text whose rows they were. if (previewOf(p, id)) |pid| { - p.panes[pid].?.attached_to = null; + p.panes[pid].?.docked_to = null; p.removePane(pid, owner_id) catch |err| p.reportError(.at(id), "query", err); q.preview = 0; } @@ -2354,7 +2354,7 @@ test "Find: names fuzzy per keystroke, the group born with its +Preview, nothing try std.testing.expectEqual(pv, p.view().active); try std.testing.expectEqual(serial, p.panes[pv].?.serial); try std.testing.expect(p.panes[pv].?.file.?.output == null); - try std.testing.expect(p.panes[pv].?.attached_to == null); + try std.testing.expect(p.panes[pv].?.docked_to == null); layout.compute(p); try std.testing.expectEqualDeep(rect, p.view().rects[pv]); try std.testing.expect(q.frozen); @@ -2754,6 +2754,6 @@ test "a query row's address reaches every way a look arrives: an empty look writ // the whole row written to the pane's look: the place a.body.cur_row = 0; const tree = @import("ninep/tree.zig"); - try std.testing.expectEqual(tree.Status.ok, @import("ninep/testing.zig").wr(p, tree.Node.of(qp.serial, .look), line).reply.status); + try std.testing.expectEqual(tree.Status.ok, @import("ninep/harness.zig").wr(p, tree.Node.of(qp.serial, .look), line).reply.status); try std.testing.expectEqual(@as(i32, 3), a.body.cur_row); } diff --git a/core/builtins.zig b/core/builtins.zig index 6f37e86d..a7340352 100644 --- a/core/builtins.zig +++ b/core/builtins.zig @@ -18,7 +18,7 @@ const keys = @import("keys.zig"); const Jump = @import("Jump.zig"); /// What this build's own frontend draws and its host does: the render's. -pub const frontend: config.Runtime.Capabilities = .{ +pub const frontend: config.Settings.Capabilities = .{ .font_picker = pardes.font_picker, // The tty's font belongs to its emulator. .tagline_font_size = pardes.platform != .tui, @@ -32,15 +32,15 @@ pub const frontend: config.Runtime.Capabilities = .{ /// its own frontend does (`viewCapabilities`), so a terminal's replica of a /// window's session steps as the window's own does, and back. pub const desktop = pardes.platform == .tui or pardes.platform == .gui; -const window_capabilities: config.Runtime.Capabilities = .{ .font_picker = true, .tagline_font_size = true, .window_opacity = true, .pixels = true }; -const terminal_capabilities: config.Runtime.Capabilities = .{ .font_picker = false, .tagline_font_size = false, .window_opacity = false, .pixels = false }; +const window_capabilities: config.Settings.Capabilities = .{ .font_picker = true, .tagline_font_size = true, .window_opacity = true, .pixels = true }; +const terminal_capabilities: config.Settings.Capabilities = .{ .font_picker = false, .tagline_font_size = false, .window_opacity = false, .pixels = false }; /// The words this build has: a desktop build's are the window's. -pub const capabilities: config.Runtime.Capabilities = if (desktop) window_capabilities else frontend; +pub const capabilities: config.Settings.Capabilities = if (desktop) window_capabilities else frontend; /// What the live view's frontend takes: a window's, or a terminal's /// (`Pardes.frontend`, which its client says, Event.frontend). -pub fn viewCapabilities(p: *const Pardes) config.Runtime.Capabilities { +pub fn viewCapabilities(p: *const Pardes) config.Settings.Capabilities { if (comptime !desktop) return frontend; return if (p.view().frontend.windowed) window_capabilities else terminal_capabilities; } @@ -136,10 +136,10 @@ fn manualBuiltinList() []const type { } } -fn settingList() []const config.Runtime.Setting { +fn settingList() []const config.Settings.Setting { comptime { - var list: []const config.Runtime.Setting = &.{}; - for (config.Runtime.settings) |setting| if (setting.enabled(capabilities)) { + var list: []const config.Settings.Setting = &.{}; + for (config.Settings.settings) |setting| if (setting.enabled(capabilities)) { list = list ++ .{setting}; }; return list; @@ -175,7 +175,7 @@ pub const registry = struct { } /// `here` for a frontend of these capabilities, windowed or not. - pub fn hereFor(b: Builtin(), caps: config.Runtime.Capabilities, windowed: bool) bool { + pub fn hereFor(b: Builtin(), caps: config.Settings.Capabilities, windowed: bool) bool { inline for (comptime manualBuiltinList(), 0..) |T, i| if (@backingInt(b) == i) return !@hasDecl(T, "in_window") or windowed; inline for (comptime settingList(), comptime manualBuiltinList().len..) |setting, i| if (@backingInt(b) == i) return setting.enabled(caps); unreachable; @@ -1131,13 +1131,13 @@ pub const Collapse = struct { } }; -/// Unattach a pane from the pane it answers for: it stays where it is, a +/// Undock a pane from the pane it answers for: it stays where it is, a /// pane of its own, and the next search from that pane opens another /// under it. -pub const Unattach = struct { +pub const Undock = struct { pub fn run(c: Ctx) void { - if (c.pane.attached_to == null) return c.p.reportFailure(c.id, "Unattach: not attached to a pane"); - c.pane.attached_to = null; + if (c.pane.docked_to == null) return c.p.reportFailure(c.id, "Undock: not docked to a pane"); + c.pane.docked_to = null; } }; @@ -1873,7 +1873,7 @@ fn testDump(buf: []u8) ![]const u8 { test "capabilities exactly gate setting builtins" { const Builtin = registry.Builtin(); - for (config.Runtime.settings) |setting| { + for (config.Settings.settings) |setting| { const registered = std.meta.stringToEnum(Builtin, setting.word) != null; try std.testing.expectEqual(setting.enabled(capabilities), registered); } diff --git a/core/builtins_json.zig b/core/builtins_json.zig index 3773e5ae..23e15098 100644 --- a/core/builtins_json.zig +++ b/core/builtins_json.zig @@ -65,11 +65,11 @@ pub fn write(w: *std.Io.Writer, addon_sources: []const []const u8) std.Io.Writer try w.writeAll(if (builtins.registry.takesArg(b)) "true" else "false"); try w.writeAll(", \"scope\": "); try str(if (b == .Edit) "both" else if (builtins.registry.scope(b) == .session) "root" else "pane", .{}, w); - const setting = config.Runtime.find(name); + const setting = config.Settings.find(name); try w.writeAll(", \"setting\": "); try w.writeAll(if (setting != null) "true" else "false"); try w.writeAll(", \"choices\": "); - if (setting) |s| if (config.Runtime.choices(s.action)) |v| try str(v, .{}, w) else try w.writeAll("null") else try w.writeAll("null"); + if (setting) |s| if (config.Settings.choices(s.action)) |v| try str(v, .{}, w) else try w.writeAll("null") else try w.writeAll("null"); var buf: [2048]u8 = undefined; const doc = if (setting) |s| s.doc else ctl.summaryOf(name, &buf); try w.writeAll(", \"doc\": "); diff --git a/core/config.zig b/core/config.zig index 792a7e62..0032b03a 100644 --- a/core/config.zig +++ b/core/config.zig @@ -79,7 +79,7 @@ pub const leader_path = paths: { .Mode = null, .Togglettymode = null, .Collapse = null, - .Unattach = null, + .Undock = null, .Undo = null, .Edit = null, .Redo = null, @@ -600,7 +600,7 @@ pub const delete_word_forward: []const Chord = &.{ .{ .cp = 'd', .alt = true }, pub const kill_to_line_start: []const Chord = &.{.{ .cp = 'u', .ctrl = true }}; pub const kill_to_line_end: []const Chord = &.{.{ .cp = 'k', .ctrl = true }}; -pub const Runtime = struct { +pub const Settings = struct { theme: usize = 0, wrap: bool = true, debug: bool = false, @@ -662,7 +662,7 @@ pub const Runtime = struct { tab: u16 = tab_width, callstack_depth: u8 = @import("lsp/lsp.zig").callstack_default_depth, - /// A setting that is one of a few words, each an enum field of Runtime. + /// A setting that is one of a few words, each an enum field of Settings. pub const Choice = enum { pet }; pub const Pet = enum { off, cat, frog }; @@ -710,7 +710,7 @@ pub const Runtime = struct { }; // Validate the complete request before changing any member. - pub fn requestFont(state: *Runtime, path: []const u8, name: []const u8, size_hundredths: u16) bool { + pub fn requestFont(state: *Settings, path: []const u8, name: []const u8, size_hundredths: u16) bool { if (path.len > state.font.requested_path.bytes.len or name.len > state.font.requested_name.bytes.len) return false; if (size_hundredths != 0 and (size_hundredths < 800 or size_hundredths > 7200)) return false; @@ -834,7 +834,7 @@ pub const Runtime = struct { } /// `home`: what `~` is (the session's: Pardes.session_home). - pub fn apply(state: *Runtime, tape: *pardes.tape.Tape, setting: Setting, argument: ?[]const u8, home: ?[]const u8) bool { + pub fn apply(state: *Settings, tape: *pardes.tape.Tape, setting: Setting, argument: ?[]const u8, home: ?[]const u8) bool { switch (setting.action) { // Every toggle names a bool field of its own, so one line covers // all of them and a new toggle needs no arm here. Bare, a toggle @@ -903,7 +903,7 @@ pub const Runtime = struct { return switch (action) { .toggle => "on, off", .choice => |which| switch (which) { - inline else => |field| comptime words.of(@FieldType(Runtime, @tagName(field))), + inline else => |field| comptime words.of(@FieldType(Settings, @tagName(field))), }, else => null, }; @@ -970,7 +970,7 @@ pub const Runtime = struct { default_dump_dir: []const u8 = "", native_images: bool = false, capabilities: Capabilities, - state: *const Runtime, + state: *const Settings, /// The `LocationsConfig` argument in effect, as it would be typed. locations: []const u8 = "", }; @@ -1068,7 +1068,7 @@ pub const Runtime = struct { } test "a toggle flips when bare and sets when told on or off" { - var state: Runtime = .{}; + var state: Settings = .{}; const verbose = find("Verbose").?; try std.testing.expect(state.verbose); // Bare, it flips: that is what a tagline word does. @@ -1090,7 +1090,7 @@ pub const Runtime = struct { } test "simple setting application mutates only its plain field" { - var state: Runtime = .{}; + var state: Settings = .{}; try std.testing.expect(apply(&state, &pardes.tape.none, find("Wrap").?, null, null)); try std.testing.expect(!state.wrap); try std.testing.expect(apply(&state, &pardes.tape.none, find("Shell").?, " fish\n", null)); @@ -1100,7 +1100,7 @@ pub const Runtime = struct { test "tagline size validates before mutating live state" { const setting = find("TaglineSize").?; - var state: Runtime = .{}; + var state: Settings = .{}; for ([_][]const u8{ "1", " 82\n", "100" }) |argument| { try std.testing.expect(apply(&state, &pardes.tape.none, setting, argument, null)); @@ -1116,7 +1116,7 @@ pub const Runtime = struct { test "window opacity defaults to opaque validates atomically and retries" { const setting = find("WindowOpacity").?; - var state: Runtime = .{}; + var state: Settings = .{}; try std.testing.expectEqual(@as(u8, 100), state.window_opacity); try std.testing.expect(state.window_opacity_pending); try std.testing.expectEqual(Capability.window_opacity, availability(setting.action).?); @@ -1141,7 +1141,7 @@ pub const Runtime = struct { } test "font request tuple rejects atomically" { - var state: Runtime = .{}; + var state: Settings = .{}; try std.testing.expect(requestFont(&state, "/fonts/old.ttf", "Old", 1200)); var too_long: [256]u8 = @splat('x'); try std.testing.expect(!requestFont(&state, "/fonts/new.ttf", &too_long, 1800)); @@ -1168,7 +1168,7 @@ pub const Runtime = struct { // The switches, Theme, Shell, Pager and the shell's own lines are // test/behaviour/settings.zig's, read through the root ctl and the // +DumpConfig pane. - var state: Runtime = .{}; + var state: Settings = .{}; // Every setting, every context line: the report outgrows 4K. var storage: [8192]u8 = undefined; const context: ReportContext = .{ @@ -1219,7 +1219,7 @@ pub const Runtime = struct { "# Native images: on\n", }) |expected| try std.testing.expect(std.mem.indexOf(u8, report, expected) != null); - var defaults: Runtime = .{}; + var defaults: Settings = .{}; var defaults_context = context; defaults_context.startup_config_path = null; defaults_context.platform = "tui"; @@ -1693,7 +1693,7 @@ test "wheel drift guard" { } test { - _ = Runtime; + _ = Settings; _ = User; } @@ -1838,14 +1838,14 @@ test "reference.typ's #fstree is the tree the session serves, file for file" { } test "CallstackDepth is bounded and keeps the last valid runtime limit" { - var state: Runtime = .{}; + var state: Settings = .{}; try std.testing.expectEqual(@as(u8, 8), state.callstack_depth); for ([_][]const u8{ "1", "8", "16", "64" }) |value| { - try std.testing.expect(Runtime.apply(&state, &pardes.tape.none, Runtime.find("CallstackDepth").?, value, null)); + try std.testing.expect(Settings.apply(&state, &pardes.tape.none, Settings.find("CallstackDepth").?, value, null)); try std.testing.expectEqual(try std.fmt.parseInt(u8, value, 10), state.callstack_depth); } for ([_][]const u8{ "0", "65", "256", "-1", "+8", "1_6", "eight", "" }) |value| { - try std.testing.expect(!Runtime.apply(&state, &pardes.tape.none, Runtime.find("CallstackDepth").?, value, null)); + try std.testing.expect(!Settings.apply(&state, &pardes.tape.none, Settings.find("CallstackDepth").?, value, null)); try std.testing.expectEqual(@as(u8, 64), state.callstack_depth); } } diff --git a/core/dump.zig b/core/dump.zig index 1616f557..a8dd170a 100644 --- a/core/dump.zig +++ b/core/dump.zig @@ -708,11 +708,11 @@ pub fn savePane(gpa: std.mem.Allocator, pane: *pardes.panes.Pane, slim: bool) ![ // The fields it changes put back after, not the whole pane (88 KB) kept // aside: a store record is made at every close. const cwd = pane.cwd; - const attached_to = pane.attached_to; + const docked_to = pane.docked_to; const terminal = pane.terminal; defer { pane.cwd = cwd; - pane.attached_to = attached_to; + pane.docked_to = docked_to; pane.terminal = terminal; } if (cwd == .inherited) { @@ -720,7 +720,7 @@ pub fn savePane(gpa: std.mem.Allocator, pane: *pardes.panes.Pane, slim: bool) ![ const dir = pane.cwdSlice(); pane.cwd = .{ .owned = @constCast(dir) }; } - pane.attached_to = null; + pane.docked_to = null; if (!slim) return walk.save(pardes.panes.Pane, gpa, pane); pane.terminal = null; const f = if (pane.file) |*file| file else return walk.save(pardes.panes.Pane, gpa, pane); @@ -985,7 +985,7 @@ test "a session with every column it may hold dumps and restores them all" { } test "a restored session's column and workspace tags take more than one selection, and its 9P files have a time" { - const th = @import("ninep/testing.zig"); + const th = @import("ninep/harness.zig"); const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .tty_only = true }); defer p.deinit(); @@ -1037,7 +1037,7 @@ test "a pane restored with unsaved text is asked about by Exit, Restore, Del and const id = for (restored.panes, 0..) |slot, i| { if (slot) |candidate| if (candidate.file != null and candidate.file.?.output == null) break i; } else return error.FileLost; - const th = @import("ninep/testing.zig"); + const th = @import("ninep/harness.zig"); const node = if (word == .Del or word == .get) ctlfs.Node.of(restored.panes[id].?.serial, .ctl) else @@ -1171,7 +1171,7 @@ test "a session's byte dump read by name, field by field as another build reads test "an old dump's file, a byte dump, is read by -l and by a Restore of its path, for one release" { const gpa = std.testing.allocator; - const th = @import("ninep/testing.zig"); + const th = @import("ninep/harness.zig"); const p = try Pardes.init(gpa, .{ .tty_only = true }); defer p.deinit(); _ = try p.setTestFile("kept in a .dump\n"); diff --git a/core/edit_cmd.zig b/core/edit_cmd.zig index 43006503..9f1f7862 100644 --- a/core/edit_cmd.zig +++ b/core/edit_cmd.zig @@ -452,7 +452,7 @@ fn commit(p: *Pardes, pd: *Pending, outputs: []const []const u8) void { } const testing = std.testing; -const th = @import("ninep/testing.zig"); +const th = @import("ninep/harness.zig"); const tree = @import("ninep/tree.zig"); /// The answer of the Edit waiting on its commands: as a host's worker diff --git a/core/exec.zig b/core/exec.zig index 687faa98..1ec47eb3 100644 --- a/core/exec.zig +++ b/core/exec.zig @@ -288,7 +288,7 @@ pub fn withArg(p: *Pardes, txt: []const u8, arg: ?[]const u8) []const u8 { // A switch (Verbose, Wrap) clicked with some other text // selected flips, as it does bare: only `on` or `off` is an argument // for it. What a ctl write gives it is checked strictly instead. - if (config.Runtime.find(commandText(t))) |setting| switch (setting.action) { + if (config.Settings.find(commandText(t))) |setting| switch (setting.action) { .toggle => if (!std.mem.eql(u8, a, "on") and !std.mem.eql(u8, a, "off")) return txt, else => {}, }; @@ -688,7 +688,7 @@ pub fn executeFrom(p: *Pardes, id: usize, txt: []const u8, from_body: bool) ?usi // A builtin or setting this build lacks (Fonts on a terminal) is said, // never run as a shell command. const word = cmd[0 .. std.mem.indexOfAny(u8, cmd, " \t") orelse cmd.len]; - if (builtins.absentWhy(word) orelse if (config.Runtime.find(word) != null) @as([]const u8, "GUI-only") else null) |why| { + if (builtins.absentWhy(word) orelse if (config.Settings.find(word) != null) @as([]const u8, "GUI-only") else null) |why| { var said: pardes.Kind.Buf(96) = .{}; p.reportFailure(id, said.print("{s} is {s}, invalid here", .{ word, why })); return null; @@ -937,7 +937,7 @@ fn applyInitText(p: *Pardes, text: []const u8, settings_only: bool) void { // `#` starts a comment only at a line's start: a value may hold one // (`#ff0000`). if (word.len == 0 or isComment(word)) continue; - const setting = config.Runtime.find(word[0 .. std.mem.indexOfAny(u8, word, " \t") orelse word.len]); + const setting = config.Settings.find(word[0 .. std.mem.indexOfAny(u8, word, " \t") orelse word.len]); // Saved in a pane, its settings run again and its commands do not: // a word that is neither (a typo) is still said, as at startup. if (settings_only and setting == null and std.meta.stringToEnum(Builtin, word[0 .. std.mem.indexOfAny(u8, word, " \t+") orelse word.len]) != null) continue; @@ -996,7 +996,7 @@ pub fn runBuiltinFrom(p: *Pardes, b: Builtin, id: usize, txt: []const u8, arg: ? builtins.registry.dispatch(b, c); } -pub fn applySettingBuiltin(p: *Pardes, setting: config.Runtime.Setting, arg: ?[]const u8) void { +pub fn applySettingBuiltin(p: *Pardes, setting: config.Settings.Setting, arg: ?[]const u8) void { const v = p.view(); const previous_tagline_percent = p.settings.font.tagline_percent; switch (setting.action) { @@ -1015,7 +1015,7 @@ pub fn applySettingBuiltin(p: *Pardes, setting: config.Runtime.Setting, arg: ?[] }, .font => { if (comptime !font_picker) return; - const spec = config.Runtime.FontSpec.parse(arg orelse return) orelse return; + const spec = config.Settings.FontSpec.parse(arg orelse return) orelse return; // The session's machine's fonts, a question to its disk: a // client's replay takes the session's answer, never its own. const found = pardes.tape.site(.fonts, p.scratch.allocator(), fontNamed, .{ p.scratch.allocator(), spec.name }); @@ -1039,7 +1039,7 @@ pub fn applySettingBuiltin(p: *Pardes, setting: config.Runtime.Setting, arg: ?[] var text: pardes.Kind.Buf(340) = .{}; return p.reportFailure(v.active, text.print("Shell: {s}", .{refused})); } - if (!p.settings.apply(p.tape, setting, want, p.sessionHome())) p.reportFailure(v.active, "Shell: takes " ++ comptime config.Runtime.takes(.shell).?); + if (!p.settings.apply(p.tape, setting, want, p.sessionHome())) p.reportFailure(v.active, "Shell: takes " ++ comptime config.Settings.takes(.shell).?); }, // Bare, each says its value, as acme's Tab says the width. inline .tab, .callstack_depth => |_, tag| if (arg == null) { @@ -1047,14 +1047,14 @@ pub fn applySettingBuiltin(p: *Pardes, setting: config.Runtime.Setting, arg: ?[] return p.setMessage(.at(v.active), said.print("{s} {d}", .{ setting.word, @field(p.settings, @tagName(tag)) })); } else if (!p.settings.apply(p.tape, setting, arg, p.sessionHome())) { var said: pardes.Kind.Buf(96) = .{}; - p.reportFailure(v.active, said.print("{s}{s}: takes {s}", .{ setting.word, if (tag == .tab) ": invalid tab width" else "", comptime config.Runtime.takes(tag).? })); + p.reportFailure(v.active, said.print("{s}{s}: takes {s}", .{ setting.word, if (tag == .tab) ": invalid tab width" else "", comptime config.Settings.takes(tag).? })); }, // Said with what it takes: its words, its range. else => if (!p.settings.apply(p.tape, setting, arg, p.sessionHome())) { var buf: [160]u8 = undefined; var text: std.Io.Writer = .fixed(&buf); // A list of values too long for the row is cut. - (if (config.Runtime.takes(setting.action)) |values| text.print("{s}: takes {s}", .{ setting.word, values }) else text.print("{s}: does not take that value", .{setting.word})) catch {}; + (if (config.Settings.takes(setting.action)) |values| text.print("{s}: takes {s}", .{ setting.word, values }) else text.print("{s}: does not take that value", .{setting.word})) catch {}; p.reportFailure(v.active, text.buffered()); }, } diff --git a/core/fs.zig b/core/fs.zig index 0a10825d..0797beb0 100644 --- a/core/fs.zig +++ b/core/fs.zig @@ -11,7 +11,7 @@ const modal = @import("modal.zig"); const look = @import("look.zig"); pub const tree = @import("ninep/tree.zig"); const sources_fs = @import("ninep/sources.zig"); -const th = @import("ninep/testing.zig"); +const th = @import("ninep/harness.zig"); const Pardes = pardes.Pardes; const MAX_PANES = pardes.MAX_PANES; diff --git a/core/keys.zig b/core/keys.zig index 92e78b0e..72e3bb3b 100644 --- a/core/keys.zig +++ b/core/keys.zig @@ -632,7 +632,7 @@ test "Del from a key asks which neighbour takes the rows; nothing else asks" { p.newScratchBelow(foot); const tail = p.view().active; { - const th = @import("ninep/testing.zig"); + const th = @import("ninep/harness.zig"); const asked = foot; p.view().active = asked; p.sync(); diff --git a/core/layout.zig b/core/layout.zig index 6ce0845f..9c99dc7d 100644 --- a/core/layout.zig +++ b/core/layout.zig @@ -339,7 +339,7 @@ pub fn movePane(p: *Pardes, id: usize, cur_x: u16, cur_y: u16) void { for (moved[0..count], 0..) |m, j| insert(p, placement.preview_col, j, m); if (count > 1) setColumnWeights(p, placement.preview_col, &heights); if (source_multi) setColumnWeights(p, src.col, &heights); - if (owner != null) p.panes[id].?.attached_to = null; + if (owner != null) p.panes[id].?.docked_to = null; return; }; const af = findPane(p, above) orelse return; @@ -367,7 +367,7 @@ pub fn movePane(p: *Pardes, id: usize, cur_x: u16, cur_y: u16) void { const pane = p.panes[id].?; // Still right under its owner's group: resized there. Anywhere // else it is a pane of its own. - if (af.col != (findPane(p, o) orelse return).col or !descends(p, above, o)) pane.attached_to = null; + if (af.col != (findPane(p, o) orelse return).col or !descends(p, above, o)) pane.docked_to = null; } } @@ -1115,7 +1115,7 @@ pub fn splitBelow(p: *Pardes, src_id: usize, nw: *Pane) void { // ---- Attached panes ---- // // A results pane (+Search, +Callstack, +Diff, +Errors) is ATTACHED to the -// pane it answers for, its owner (Pane.attached_to). The owner and what is +// pane it answers for, its owner (Pane.docked_to). The owner and what is // attached to it, and what is attached to those (a preview under a // +Search), are a GROUP: contiguous in one column, the owner first. A group // is one place to everything else in the layout: an unrelated pane is never @@ -1126,7 +1126,7 @@ pub fn splitBelow(p: *Pardes, src_id: usize, nw: *Pane) void { /// The slot of `id`'s owner, when `id` is attached to a live pane. pub fn ownerOf(p: *const Pardes, id: usize) ?usize { - const serial = (p.panes[id] orelse return null).attached_to orelse return null; + const serial = (p.panes[id] orelse return null).docked_to orelse return null; for (p.panes, 0..) |slot, i| if (slot) |pane| if (pane.serial == serial and i != id) return i; return null; } @@ -1168,10 +1168,10 @@ pub fn groupEnd(p: *const Pardes, c: usize, idx: usize) usize { pub fn keepGroups(p: *Pardes) void { for (0..p.view().ncol) |c| for (p.view().cols[c].panes[0..p.view().cols[c].n], 0..) |id, k| { const pane = p.panes[id] orelse continue; - if (pane.attached_to == null) continue; + if (pane.docked_to == null) continue; const kept = if (ownerOf(p, id)) |owner| k > 0 and descends(p, p.view().cols[c].panes[k - 1], owner) else false; if (kept) continue; - pane.attached_to = null; + pane.docked_to = null; }; } @@ -1206,7 +1206,7 @@ pub fn attachFrom(p: *Pardes, owner: usize, id: usize, rows: u16, giver: usize) insert(p, f.col, groupEnd(p, f.col, f.idx), id); g.vweight = @floatFromInt(oh - give); nw.vweight = @floatFromInt(give); - nw.attached_to = o.serial; + nw.docked_to = o.serial; compute(p); return true; } @@ -1991,9 +1991,9 @@ test "an attachment survives Dump and Restore, and one left away from its owner const restored = try dump.initFromDump(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 40 }, p.dump_out.?); defer restored.deinit(); try std.testing.expectEqual(@as(?usize, 0), ownerOf(restored, s)); - // Unattach: a pane of its own where it stands. - pardes.exec.runBuiltin(p, .Unattach, s, "", null); - try std.testing.expect(p.panes[s].?.attached_to == null); + // Undock: a pane of its own where it stands. + pardes.exec.runBuiltin(p, .Undock, s, "", null); + try std.testing.expect(p.panes[s].?.docked_to == null); // Put above its owner by a route that does not carry groups: detached. const t = try testAttachment(p); try std.testing.expect(attachFrom(p, 0, t, 8, 0)); @@ -2001,7 +2001,7 @@ test "an attachment survives Dump and Restore, and one left away from its owner removePane(p, t); insert(p, 0, 0, t); compute(p); - try std.testing.expect(p.panes[t].?.attached_to == null); + try std.testing.expect(p.panes[t].?.docked_to == null); } test "a new column takes width only from the column that created it" { diff --git a/core/look.zig b/core/look.zig index f7084079..1023a532 100644 --- a/core/look.zig +++ b/core/look.zig @@ -2302,7 +2302,7 @@ test "every entry point to Look takes one expansion: a diff line and a file:12:5 var fx: DiffFixture = undefined; try fx.init(true, &.{.{ "src/x.zig", numbered }}, diff_text); defer fx.tmp.cleanup(); - const th = @import("ninep/testing.zig"); + const th = @import("ninep/harness.zig"); // `column` -1: wherever a click puts it, every other way the same. const Case = struct { text: []const u8, name: []const u8, row: u16, col: u16, sweep: [2]u16, line: i32, column: i32 }; const cases = [_]Case{ @@ -2391,7 +2391,7 @@ test "a tag word looked at by a click and by Enter is one record to an event rea var fx: DiffFixture = undefined; try fx.init(true, &.{.{ "src/x.zig", "line one\n" }}, diff_text); defer fx.tmp.cleanup(); - const th = @import("ninep/testing.zig"); + const th = @import("ninep/harness.zig"); const p = try Pardes.init(std.testing.allocator, .{ .cols = 100, .rows = 30 }); defer p.deinit(); const pane = try fx.open(p, diff_text); diff --git a/core/mouse.zig b/core/mouse.zig index 3d7c5af9..cefc0335 100644 --- a/core/mouse.zig +++ b/core/mouse.zig @@ -1497,7 +1497,7 @@ test "mouse thumb buttons navigate once and clear selection gestures" { } test "a chorded exec an event reader holds is told with its argument, and written back runs with it" { - const th = @import("ninep/testing.zig"); + const th = @import("ninep/harness.zig"); const p = try th.withFile(std.testing.allocator, "Msg said\narg-text\n"); defer p.deinit(); const serial = p.panes[0].?.serial; diff --git a/core/ninep/addr.zig b/core/ninep/addr.zig index 72a2d815..fd343363 100644 --- a/core/ninep/addr.zig +++ b/core/ninep/addr.zig @@ -319,7 +319,7 @@ pub const Addr = struct { }; const testing = std.testing; -const th = @import("testing.zig"); +const th = @import("harness.zig"); const tree = @import("tree.zig"); const Node = tree.Node; const E = tree.E; diff --git a/core/ninep/cols.zig b/core/ninep/cols.zig index 561a5ffa..88d8ef88 100644 --- a/core/ninep/cols.zig +++ b/core/ninep/cols.zig @@ -241,7 +241,7 @@ pub fn remove(p: *Pardes, req: Req, serial: u32, file: tree.ColFile) Reply { // ---- tests ---- const testing = std.testing; -const th = @import("testing.zig"); +const th = @import("harness.zig"); const Node = tree.Node; test "New written to a column's exec makes its scratch in the session's directory, as tagexec's does" { diff --git a/core/ninep/ctl.zig b/core/ninep/ctl.zig index 302b916a..7b4e2754 100644 --- a/core/ninep/ctl.zig +++ b/core/ninep/ctl.zig @@ -298,7 +298,7 @@ pub fn captured(p: *Pardes, req: Req, id: usize, exec: bool, text: []const u8, i // ...and one that takes none, written with one (`Config extra`): // refused as a ctl's is, not run as a shell command of that name. if (std.mem.indexOfAny(u8, cmd, " \t")) |sp| if (std.meta.stringToEnum(Builtin, cmd[0..sp])) |b| { - if (!builtins.registry.takesArg(b) and config.Runtime.find(cmd[0..sp]) == null) { + if (!builtins.registry.takesArg(b) and config.Settings.find(cmd[0..sp]) == null) { p.fs.results_len = 0; return refuse(p, req, "wrong #args in control message", cmd); } @@ -535,7 +535,7 @@ fn checkBuiltin(p: *Pardes, req: Req, line: []const u8, scope: builtins.Scope) ? // A setting this build's frontend cannot show (Lift, GripWidth on a // terminal, the window's own words in a terminal's view) is known, // and says so rather than sound misspelt. - if (builtins.absentWhy(word) orelse if (config.Runtime.find(word) != null or std.meta.stringToEnum(Builtin, word) != null) @as([]const u8, "GUI-only") else null) |absent| { + if (builtins.absentWhy(word) orelse if (config.Settings.find(word) != null or std.meta.stringToEnum(Builtin, word) != null) @as([]const u8, "GUI-only") else null) |absent| { var why: pardes.Kind.Buf(64) = .{}; // EINVAL, a request this build cannot take, in words 9ns reads // as that: `invalid`. @@ -553,7 +553,7 @@ fn checkBuiltin(p: *Pardes, req: Req, line: []const u8, scope: builtins.Scope) ? ": write it to pane/<n>/ctl"); if (arg.len > 0 and !builtins.registry.takesArg(b)) return refuse(p, req, "wrong #args in control message", line); if (arg.len == 0 and builtins.registry.requiresArg(b)) return refuse(p, req, "wrong #args in control message", line); - const setting = config.Runtime.find(word) orelse return null; + const setting = config.Settings.find(word) orelse return null; const takes = switch (setting.action) { .theme => if (pardes.colors.themeIndex(arg) != null) true else { // `refuse` quotes the line after it, all in the 128 bytes an @@ -565,7 +565,7 @@ fn checkBuiltin(p: *Pardes, req: Req, line: []const u8, scope: builtins.Scope) ? var why: pardes.Kind.Buf(256) = .{}; return refuse(p, req, why.print(head ++ "{s}" ++ tail, .{pardes.colors.themesNear(near[0..@min(room, near.len)], arg)}), arg); }, - .font => config.Runtime.FontSpec.parse(arg) != null, + .font => config.Settings.FontSpec.parse(arg) != null, // Bare, it says the width, as from a pane's exec. .tab => arg.len == 0 or (std.fmt.parseInt(u16, arg, 10) catch 0) -% 1 < 16, .callstack_depth => arg.len == 0 or (std.fmt.parseInt(u8, arg, 10) catch 0) -% 1 < pardes.lsp.callstack_max_depth, @@ -578,7 +578,7 @@ fn checkBuiltin(p: *Pardes, req: Req, line: []const u8, scope: builtins.Scope) ? var why: pardes.Kind.Buf(160) = .{}; // The offending word is the value: quoted, so two bad values read, // and log, as two. - return refuseQuoting(p, req, if (config.Runtime.takes(setting.action)) |values| + return refuseQuoting(p, req, if (config.Settings.takes(setting.action)) |values| why.print("bad value in control message; takes {s}", .{values}) else "bad value in control message", arg, ""); @@ -628,13 +628,13 @@ fn writeSettings(p: *Pardes, w: *std.Io.Writer) !void { /// The setting words of `s`, one a line, those a frontend of `caps` takes /// (the root ctl's: the live view's), and the session's LocationsConfig. -fn writeSettingsFor(p: *Pardes, s: *const config.Runtime, w: *std.Io.Writer, caps: config.Runtime.Capabilities) !void { +fn writeSettingsFor(p: *Pardes, s: *const config.Settings, w: *std.Io.Writer, caps: config.Settings.Capabilities) !void { // DumpConfig's words: a `# Word unsupported` comment for what `caps` lacks. var dump_dir: [1024]u8 = undefined; var located_buf: [256]u8 = undefined; var located: std.Io.Writer = .fixed(&located_buf); try p.locations_config.write(&located); - try config.Runtime.writeSettings(w, .{ + try config.Settings.writeSettings(w, .{ .locations = located.buffered(), .theme_name = p.theme().name, .theme_file = pardes.colors.loadedThemeFile(p), @@ -879,7 +879,7 @@ fn writeCommands(p: *const Pardes, w: *std.Io.Writer) !void { }); // A setting that chooses among words: the words, comma-joined. Bare, // it steps to the next of them (a two-valued one flips). - if (config.Runtime.find(@tagName(b))) |setting| if (config.Runtime.choices(setting.action)) |values| { + if (config.Settings.find(@tagName(b))) |setting| if (config.Settings.choices(setting.action)) |values| { try w.writeByte(' '); var parts = std.mem.splitSequence(u8, values, ", "); var first = true; @@ -887,7 +887,7 @@ fn writeCommands(p: *const Pardes, w: *std.Io.Writer) !void { }; // Then ` -- ` and what it does: a setting's doc, else its source's. var summary_buf: [2048]u8 = undefined; - const summary = if (config.Runtime.find(@tagName(b))) |setting| setting.doc else summaryOf(@tagName(b), &summary_buf); + const summary = if (config.Settings.find(@tagName(b))) |setting| setting.doc else summaryOf(@tagName(b), &summary_buf); if (summary.len > 0) { // The sentence whole unless it is long, then cut between words. const kept = @import("../Messages.zig").clip(summary, 240); @@ -1323,7 +1323,7 @@ pub fn get(p: *Pardes, pane: *Pane) GetError!void { // ---- tests ---- const testing = std.testing; -const th = @import("testing.zig"); +const th = @import("harness.zig"); const call = th.call; const rd = th.rd; const wr = th.wr; @@ -1374,7 +1374,7 @@ test "commands lists every builtin with its argument and the ctl that takes it" const b = std.meta.stringToEnum(Builtin, words.next().?).?; if (builtins.registry.takesArg(b)) try testing.expectEqualStrings("arg", words.next().?); try testing.expectEqualStrings(if (b == .Edit) "both" else if (builtins.registry.scope(b) == .session) "root" else "pane", words.next().?); - if (config.Runtime.find(@tagName(b))) |s| if (config.Runtime.choices(s.action) != null) try testing.expect(words.next() != null); + if (config.Settings.find(@tagName(b))) |s| if (config.Settings.choices(s.action) != null) try testing.expect(words.next() != null); // Then, where the source has one, ` -- ` and what it does. if (words.next()) |dashes| try testing.expectEqualStrings("--", dashes); } @@ -1766,7 +1766,7 @@ test "after a ThemeFile the root ctl and DumpConfig say ThemeFile and its path, try testing.expect(std.mem.indexOf(u8, settings, "Theme mine") == null); var storage: [16384]u8 = undefined; var out: std.Io.Writer = .fixed(&storage); - try config.Runtime.writeReport(&out, .{ + try config.Settings.writeReport(&out, .{ .startup_config_path = null, .platform = @tagName(pardes.platform), .theme_name = p.theme().name, @@ -2490,7 +2490,7 @@ test "every word's /commands description is its own doc comment's first sentence continue; }; const word = line[0..std.mem.indexOfScalar(u8, line, ' ').?]; - if (config.Runtime.find(word)) |setting| { + if (config.Settings.find(word)) |setting| { try testing.expect(std.mem.endsWith(u8, line, setting.doc)); continue; } @@ -2890,7 +2890,7 @@ test "the init file reads past a BOM, and every line it fails is a notice and an } test "a setting the other frontend has is passed over in the init file, not failed" { - const other = for (config.Runtime.settings) |s| { + const other = for (config.Settings.settings) |s| { if (!s.enabled(pardes.builtins.capabilities)) break s.word; } else return; // this frontend has them all var text: [64]u8 = undefined; diff --git a/core/ninep/events.zig b/core/ninep/events.zig index 93a1187a..1951a434 100644 --- a/core/ninep/events.zig +++ b/core/ninep/events.zig @@ -828,7 +828,7 @@ pub fn writeEvent(p: *Pardes, asked: Req, id: usize) Reply { // ---- tests ---- const testing = std.testing; -const th = @import("testing.zig"); +const th = @import("harness.zig"); const call = th.call; const rd = th.rd; const wr = th.wr; diff --git a/core/ninep/testing.zig b/core/ninep/harness.zig index cf75d80d..cf75d80d 100644 --- a/core/ninep/testing.zig +++ b/core/ninep/harness.zig diff --git a/core/ninep/pane.zig b/core/ninep/pane.zig index 8be26602..1d514a3c 100644 --- a/core/ninep/pane.zig +++ b/core/ninep/pane.zig @@ -1031,7 +1031,7 @@ pub fn truncate(p: *Pardes, pane: *Pane, file: PaneFile) tree.Status { // ---- tests ---- const testing = std.testing; -const th = @import("testing.zig"); +const th = @import("harness.zig"); const call = th.call; const rd = th.rd; const wr = th.wr; diff --git a/core/ninep/pty.zig b/core/ninep/pty.zig index 6f3a8af0..26bb7661 100644 --- a/core/ninep/pty.zig +++ b/core/ninep/pty.zig @@ -469,7 +469,7 @@ pub fn writeData(p: *Pardes, req: Req, id: usize) Reply { // ---- tests ---- const testing = std.testing; -const th = @import("testing.zig"); +const th = @import("harness.zig"); const events = @import("events.zig"); const call = th.call; const rd = th.rd; diff --git a/core/ninep/screen.zig b/core/ninep/screen.zig index 1e2791b1..1e31bac0 100644 --- a/core/ninep/screen.zig +++ b/core/ninep/screen.zig @@ -83,7 +83,7 @@ pub fn listenersText(p: *Pardes) std.Io.Writer.Error![]const u8 { // ---- tests ---- const testing = std.testing; -const th = @import("testing.zig"); +const th = @import("harness.zig"); const fs = @import("../fs.zig"); const call = th.call; const rd = th.rd; diff --git a/core/ninep/sources.zig b/core/ninep/sources.zig index 1d804e31..540506d4 100644 --- a/core/ninep/sources.zig +++ b/core/ninep/sources.zig @@ -109,7 +109,7 @@ pub fn handle(p: *Pardes, req: Req) Reply { } const testing = std.testing; -const th = @import("testing.zig"); +const th = @import("harness.zig"); const limits = @import("../memory.zig").limits; test "embedded sources appear under the root only when the build carries them" { diff --git a/core/ninep/tree.zig b/core/ninep/tree.zig index d5a6b2fe..46a4e3d2 100644 --- a/core/ninep/tree.zig +++ b/core/ninep/tree.zig @@ -1504,7 +1504,7 @@ fn writeSend(p: *Pardes, req: Req) Reply { // ---- tests ---- const testing = std.testing; -const th = @import("testing.zig"); +const th = @import("harness.zig"); const config = @import("../config.zig"); const call = th.call; const rd = th.rd; diff --git a/core/panes.zig b/core/panes.zig index b928917a..72ca3eea 100644 --- a/core/panes.zig +++ b/core/panes.zig @@ -144,7 +144,7 @@ pub const Pane = struct { /// closes with it (layout.zig, "Attached panes"). An owner that is /// gone, or a pane no longer right under its owner's group, leaves it /// an ordinary pane (layout.keepGroups). - attached_to: ?u32 = null, + docked_to: ?u32 = null, /// This pane is a query pane: its line 1 the query, its rows made live /// from a source (Query.zig, gpa-owned). query: ?*Query = null, @@ -1437,7 +1437,7 @@ pub fn removePane(p: *Pardes, id: usize, to: ?usize) error{OutOfMemory}!void { const pane = p.panes[id] orelse return; // What is attached to it closes with it, first, each giving its rows // back to it: then its rows, theirs among them, go where a pane's go. - for (0..p.panes.len) |k| if (p.panes[k]) |other| if (k != id and other.attached_to == pane.serial) { + for (0..p.panes.len) |k| if (p.panes[k]) |other| if (k != id and other.docked_to == pane.serial) { if (layout.ownerOf(p, k) != id) continue; try p.removePane(k, id); layout.compute(p); diff --git a/core/sam_edit.zig b/core/sam_edit.zig index 0f4a70ba..700c2c01 100644 --- a/core/sam_edit.zig +++ b/core/sam_edit.zig @@ -1158,7 +1158,7 @@ fn expectEdit(text: []const u8, command: []const u8, want: []const u8) !void { } test "an x over 100k lines is 100k searches, each with its own step budget" { - const th = @import("ninep/testing.zig"); + const th = @import("ninep/harness.zig"); const line = &@as([80]u8, @splat('x')) ++ "\n"; const text = try std.testing.allocator.alloc(u8, line.len * 100_000); defer std.testing.allocator.free(text); diff --git a/core/surface.zig b/core/surface.zig index fdcb52c8..6e05f25f 100644 --- a/core/surface.zig +++ b/core/surface.zig @@ -221,7 +221,7 @@ pub const Facts = struct { forward: bool = false, cursor_blink: bool = true, jump_trail: bool = false, - pet: config.Runtime.Pet = .off, + pet: config.Settings.Pet = .off, inactive_dim: u8 = 0, tagline_percent: u8 = 100, diff --git a/core/tagline.zig b/core/tagline.zig index 456a6b6e..fa25b2c1 100644 --- a/core/tagline.zig +++ b/core/tagline.zig @@ -35,9 +35,9 @@ pub const terminal_pane_tail = " " ++ config.terminal_pane_builtins_str; pub const command_pane_tail = " " ++ config.command_pane_builtins_str; pub const dir_pane_tail = " " ++ config.dir_pane_builtins_str; /// A query pane's while its rows are made (Query.zig), and once Enter froze -/// them into text a Save keeps; Unattach leaves it where it stands. +/// them into text a Save keeps; Undock leaves it where it stands. pub const query_live_tail = " Del"; -pub const query_frozen_tail = " Save Unattach Del"; +pub const query_frozen_tail = " Save Undock Del"; /// ...and while its Grep waits at 2000 lines for More (Stream.zig). pub const query_capped_tail = " More Del"; /// A file with changes it has not saved. diff --git a/core/tape.zig b/core/tape.zig index 00486666..5ba999bf 100644 --- a/core/tape.zig +++ b/core/tape.zig @@ -1777,7 +1777,7 @@ test "every place that sets the global tape aside sets the core's field aside: a test "a client's frame drawn between its steps records nothing into its idle tape" { const gpa = std.testing.allocator; - const p = try @import("ninep/testing.zig").withFile(gpa, "x\n"); + const p = try @import("ninep/harness.zig").withFile(gpa, "x\n"); defer p.deinit(); const bytes = try pardes.dump.dumpBytes(p); defer p.gpa.free(bytes); diff --git a/core/views.zig b/core/views.zig index 9985288d..89dcb454 100644 --- a/core/views.zig +++ b/core/views.zig @@ -33,7 +33,7 @@ pub const max = 4; /// A pane's fields that are each view's own: where it is in the view's /// layout, which of its texts has the keyboard, how far it is scrolled, and /// what the view's step measured of it (its tag's rows, its bands). -const pane_fields = [_][:0]const u8{ "focus", "vweight", "collapsed", "attached_to", "hscroll", "tag_scroll", "tag_top", "tag_rows", "view", "notices", "pan", "follow_scroll" }; +const pane_fields = [_][:0]const u8{ "focus", "vweight", "collapsed", "docked_to", "hscroll", "tag_scroll", "tag_top", "tag_rows", "view", "notices", "pan", "follow_scroll" }; /// The body's: its cursor, selections and mode. Its undo stays the pane's. const body_fields = [_][:0]const u8{ "mode", "cur_pinned", "cur_row", "cur_col", "vsel", "sels", "nsel", "select", "sticky_col", "restore_cursor", "last_edit", "reg_wait", "normal", "find_op", "find_ch" }; @@ -43,7 +43,7 @@ pub const PaneView = struct { focus: Pane.Focus = .body, vweight: f32 = 1, collapsed: bool = false, - attached_to: ?u32 = null, + docked_to: ?u32 = null, hscroll: i32 = 0, tag_scroll: u16 = 0, tag_top: u16 = 0, diff --git a/dev/gui/gui.zig b/dev/gui/gui.zig index c147c2e2..3aed1ed6 100644 --- a/dev/gui/gui.zig +++ b/dev/gui/gui.zig @@ -595,7 +595,7 @@ fn acknowledgeGuiFont(g: *const Gui, core: *pardes.Pardes) void { /// A replica client's font is the window's raster state: it follows the /// session's request by the face's name on this machine (fonts.fromSession), /// never acknowledging it or otherwise changing the replicated core. -fn syncReplicaFont(g: *Gui, f: *const @FieldType(pardes.config.Runtime, "font"), gpa: std.mem.Allocator) bool { +fn syncReplicaFont(g: *Gui, f: *const @FieldType(pardes.config.Settings, "font"), gpa: std.mem.Allocator) bool { const path = f.requested_path.get(); const name = f.requested_name.get(); if (path.len == 0 and name.len == 0) return false; @@ -5857,7 +5857,7 @@ fn cursorDecor(g: *Gui, gpa: std.mem.Allocator, surface: *const pardes.Surface, /// The triangle overlay: the cursor's glide, over everything. fn buildOverlay( g: *Gui, - which: pardes.config.Runtime.Pet, + which: pardes.config.Settings.Pet, trail_on: bool, surface: *const pardes.Surface, now_ns: u64, @@ -5906,7 +5906,7 @@ fn appendJumpTrail(g: *Gui, on: bool, surface: *const pardes.Surface, now_ns: u6 /// The workspace tag's pet (the Pet setting, gui/pet.zig): in the blank /// end of the grid's first row, past the tag's text, in the tag's colours, /// on the window's own clock. Nothing of it reaches the core. -fn appendWorkspacePet(g: *Gui, which: pardes.config.Runtime.Pet, surface: *const pardes.Surface, builder: *OverlayBuilder) void { +fn appendWorkspacePet(g: *Gui, which: pardes.config.Settings.Pet, surface: *const pardes.Surface, builder: *OverlayBuilder) void { const kind: pet.Kind = @fromBackingInt(@backingInt(which)); if (kind == .off or surface.rows == 0 or surface.cols == 0) { g.pet_state = .{}; diff --git a/dev/jump_trail.zig b/dev/jump_trail.zig index 25eba636..05664ec1 100644 --- a/dev/jump_trail.zig +++ b/dev/jump_trail.zig @@ -4,7 +4,7 @@ //! the cursor of the Surface it shows, frame after frame, and times the fade //! on its own clock; the tty tints those cells' ground toward the text, the //! window draws over them. Nothing of it reaches the core, which keeps the -//! setting alone (config.Runtime.jump_trail). +//! setting alone (config.Settings.jump_trail). const std = @import("std"); pub const life_ns: u64 = 120 * std.time.ns_per_ms; diff --git a/dev/macos/Sources/AppDelegate.swift b/dev/macos/Sources/AppDelegate.swift index 767d3766..4168999f 100644 --- a/dev/macos/Sources/AppDelegate.swift +++ b/dev/macos/Sources/AppDelegate.swift @@ -132,7 +132,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, PardesViewDelegate { // to change the day macos_min_version reaches 14. NSApp.activate(ignoringOtherApps: true) - var runtime = pardes_runtime_s( + var runtime = pardes_callbacks_s( userdata: Unmanaged.passUnretained(self).toOpaque(), wakeup: { ud in // A pty reader thread. Every other function in pardes.h is diff --git a/docs/ghostty-macos-notes.md b/docs/ghostty-macos-notes.md index 830d4b1f..3dc03265 100644 --- a/docs/ghostty-macos-notes.md +++ b/docs/ghostty-macos-notes.md @@ -56,10 +56,10 @@ comptime { The payoff is that adding a feature adds an enum case, not a struct field: hosts that do not implement it return `false` and the ABI never changed. Worth copying the day a fixed callback list starts growing. pardes has three callbacks today -— `wakeup`, `set_clipboard`, `read_clipboard` (`Runtime` in `runtime/macos.zig:153`) +— `wakeup`, `set_clipboard`, `read_clipboard` (`Callbacks` in `runtime/macos.zig:153`) — and does not need it yet. -Two userdata scopes, worth noting: the runtime struct's `userdata` is +Two userdata scopes, worth noting: the callbacks struct's `userdata` is app-scoped, and each surface carries its own. Swift round-trips both with `Unmanaged.passUnretained(self).toOpaque()` — libghostty never retains, so lifetime stays entirely on the Swift side. diff --git a/docs/macos.md b/docs/macos.md index 44b77d67..98cd5312 100644 --- a/docs/macos.md +++ b/docs/macos.md @@ -85,7 +85,7 @@ copies had in common is the argument for the shared file existing: none set the pty master, so a program in one pane could read and write another pane's terminal and closing a master did not reliably hang its shell up. -That is why the runtime struct is three callbacks rather than a second vtable — +That is why the callbacks struct is three callbacks rather than a second vtable — and why two of the three are the clipboard: the pasteboard is AppKit's, in both directions, and is the one piece of IO the Zig side cannot reach for itself. @@ -128,7 +128,7 @@ is made of and what opens a path from argv or the Dock (`Look <path>`). it. `pardes_resize` also carries one cell in *physical* pixels, which only the native PDF placement path reads — pass the backing-store size, not points. -**Runtime callbacks.** `pardes_runtime_s` is a `userdata` and three functions, +**Callbacks.** `pardes_callbacks_s` is a `userdata` and three functions, copied by value during init so the struct need not outlive the call. `wakeup` means "your state moved, please pump me". `set_clipboard` hands over text to put on the pasteboard, borrowed for the duration of the call; it fires inside a tick diff --git a/docs/next-daemon.md b/docs/next-daemon.md index f4682b56..37ba0241 100644 --- a/docs/next-daemon.md +++ b/docs/next-daemon.md @@ -339,7 +339,7 @@ the ponytail lens: one on a plain terminal differ. The 223 comptime platform branches stay comptime: a session is one build, which the semantics hash says. - Each pane's, each view's own (`PaneView`): `vweight`, `collapsed` and - `attached_to` (a layout's); `focus`; the body's mode, cursor, + `docked_to` (a layout's); `focus`; the body's mode, cursor, selections, sticky column, pending normal command and find; a document's scroll, `hscroll` and size; and what the step measured for that view (`tag_rows`, `tag_top`, `tag_scroll`, `view`, `notices`), so a view drawn diff --git a/docs/next-terminal.md b/docs/next-terminal.md index 26996897..2d033380 100644 --- a/docs/next-terminal.md +++ b/docs/next-terminal.md @@ -230,7 +230,7 @@ What differs from the plan above, and why: of them fail for want of a terminal (they open a shell or a command pane, read the emulator, or index the classic boot's three shells) and say so on their first line (`if (pardes.Term.ops == null) return - error.SkipZigTest; // a shell`), and ninep/testing.zig's `withTerm` + error.SkipZigTest; // a shell`), and ninep/harness.zig's `withTerm` once for its 29. The rest run. core-test: 810 of 949 run, 139 skip; `shell-test` runs all of them with the terminal. The 28 tests that read terminal.zig's own state through a core are in test/terminal.zig diff --git a/docs/next-tests.md b/docs/next-tests.md index 2266b06a..7da60470 100644 --- a/docs/next-tests.md +++ b/docs/next-tests.md @@ -13,7 +13,7 @@ agent's survey. The `e2e` line (kbdin, mousein) is its first step. `mousein`), the process (flags, daemon, attach, signals, terminal bytes), and files on disk and effects. A rewrite that keeps those keeps its tests. - **T1, in-process 9P, is the main tier.** The core is driven only through - `serveFs` (core/ninep/testing.zig's `call`, `rd`, `wr`): as behavioural + `serveFs` (core/ninep/harness.zig's `call`, `rd`, `wr`): as behavioural as a client on a socket, and milliseconds a case. - **One process runner, not Python (the user, 2026-11-04):** test/process.zig's `Process` starts `pardes` detached (over its socket), in a pty, or as the diff --git a/docs/next-winmode.md b/docs/next-winmode.md index 6c8e3610..1f7c87c2 100644 --- a/docs/next-winmode.md +++ b/docs/next-winmode.md @@ -36,7 +36,7 @@ Typed in one go, the `j` after `SPC d` lands 100-250 ms after the `d` waiting to see something happen. 400 ms clears a relaxed typist with margin and is still quick enough to read as "it is asking", not "it is broken". Key-hint popups elsewhere (which-key) wait a few hundred ms for the same reason. It is a compile-time -constant beside `del_question` (keys are compiled in); a Runtime setting +constant beside `del_question` (keys are compiled in); a `Settings` field would be one line in config if the author wants to tune it live. ## Tests diff --git a/docs/search-proto-converge.md b/docs/search-proto-converge.md index ddc41196..da336f7c 100644 --- a/docs/search-proto-converge.md +++ b/docs/search-proto-converge.md @@ -15,7 +15,7 @@ only the prompts that are not search. | piece | file | lifted from | |---|---|---| -| attached panes: a group under its owner, rows from the owner alone, moving/folding/closing with it, seam drag, Dump/Restore, `Unattach` | `core/layout.zig` "Attached panes", `Pane.attached_to` | attached | +| attached panes: a group under its owner, rows from the owner alone, moving/folding/closing with it, seam drag, Dump/Restore, `Undock` | `core/layout.zig` "Attached panes", `Pane.docked_to` | attached | | places: every match tinted, rail ticks (B1 on a tick goes there), current selected and in view, smart-case regex, view-first sliced scan, silent wrap | `core/Places.zig`, `Pane.places` | incsearch (MatchSet) | | the query pane: line 1, its first word the source, live rows, preview, Enter/Esc/Del, reuse, settings | `core/Query.zig`, `Pane.query` | queryline, pick, live, preview, everywhere | | fuzzy names (files, recent, panes, declarations) | `core/Names.zig` | pick (its scorer, whole) | @@ -115,7 +115,7 @@ erases it and B2 / B3 on it take the word clicked, as on any row. **Enter** puts the keyboard on the current hit in its pane (the +Preview promoted in place: same slot, serial, rect, an unattached file pane from then on), fills `/`, and freezes the rows into ordinary text (tag ` Save -Unattach Del`). A `/` freezes its whole list (every place found first, 2000 +Undock Del`). A `/` freezes its whole list (every place found first, 2000 rows at most), a Grep every line it has. **Esc** while typing puts every view back, clears the places it fed and closes the pane, its rows back to the owner; a reused pane's frozen rows and their places come back instead. @@ -145,7 +145,7 @@ cursor on line 15000. | keystroke 1, `p` | Every `p` in the view tinted at once, the rest found a 4 ms slice a frame (the tag `1/38479+` until done); rail ticks fill in; the first `p` at or after the cursor selected in layout.zig (scrolled only if off screen). Rows: the lines holding `p`, each ` 15003 code`, from two before the current one, the current marked as the visited row, a note row above saying how many places come before them. | | keystroke 2, `a` | `pa`: tints, ticks and rows narrow (`1/10189`); the current is again the first at or after where `/` was pressed, not after the last preview. The pane is the same size, line 1 where it was. | | Ctrl-n / Ctrl-p | The next / previous `pa` current, selected in layout.zig; `2/10189`. | -| Enter | The keyboard on that `pa`, `pa` in `/`, the rows frozen (the whole list, 2000 rows), tag `+Search 2/10189 Save Unattach Del`; tints and ticks stay while the pane lives. Ctrl-o goes back to where `/` was pressed. | +| Enter | The keyboard on that `pa`, `pa` in `/`, the rows frozen (the whole list, 2000 rows), tag `+Search 2/10189 Save Undock Del`; tints and ticks stay while the pane lives. Ctrl-o goes back to where `/` was pressed. | | `n` | The next `pa` in layout.zig, `3/10189`, its row marked in the +Search. | | `N` | Back to `2/10189`; from the first, round to the last with no message. | | Esc (typing) | layout.zig's selection and scroll exactly as at `/`, tints and ticks gone, the +Search closed, its rows back to layout.zig. | diff --git a/docs/typ/builtins-gui.json b/docs/typ/builtins-gui.json index 8ed70b10..732e66a7 100644 --- a/docs/typ/builtins-gui.json +++ b/docs/typ/builtins-gui.json @@ -101,8 +101,8 @@ {"name": "Togglettymode", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Switch this terminal between raw program input and normal editor mode."}, {"name": "TreeContext", "leader": null, "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Show the declarations enclosing the top row at the pane's head, on or off."}, {"name": "Tutor", "leader": "SPC h t", "also": ["topbar"], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "Open the tutor, a document to work through."}, - {"name": "Unattach", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Unattach a pane from the pane it answers for: it stays where it is, a pane of its own, and the next search from that pane opens another under it."}, {"name": "Undo", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "acme's Undo and Redo: step the pane's body back or forward through its edits, from a tag, a pane ctl or exec."}, + {"name": "Undock", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Undock a pane from the pane it answers for: it stays where it is, a pane of its own, and the next search from that pane opens another under it."}, {"name": "Unfollow", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Take this pane out of its Follow chain: it stays, a Zerox twin with the scroll it has, and the chain closes up behind it."}, {"name": "Unmount", "leader": null, "also": [], "arg": true, "scope": "root", "setting": false, "choices": null, "doc": "Unmount the 9P tree mounted under /n/<name>."}, {"name": "Up", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Move the keyboard to the pane above, and from a column's top pane to its tag."}, diff --git a/docs/typ/builtins-tui.json b/docs/typ/builtins-tui.json index aa95d9a6..0a074c44 100644 --- a/docs/typ/builtins-tui.json +++ b/docs/typ/builtins-tui.json @@ -95,8 +95,8 @@ {"name": "Togglettymode", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Switch this terminal between raw program input and normal editor mode."}, {"name": "TreeContext", "leader": null, "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Show the declarations enclosing the top row at the pane's head, on or off."}, {"name": "Tutor", "leader": "SPC h t", "also": ["topbar"], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "Open the tutor, a document to work through."}, - {"name": "Unattach", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Unattach a pane from the pane it answers for: it stays where it is, a pane of its own, and the next search from that pane opens another under it."}, {"name": "Undo", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "acme's Undo and Redo: step the pane's body back or forward through its edits, from a tag, a pane ctl or exec."}, + {"name": "Undock", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Undock a pane from the pane it answers for: it stays where it is, a pane of its own, and the next search from that pane opens another under it."}, {"name": "Unfollow", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Take this pane out of its Follow chain: it stays, a Zerox twin with the scroll it has, and the chain closes up behind it."}, {"name": "Unmount", "leader": null, "also": [], "arg": true, "scope": "root", "setting": false, "choices": null, "doc": "Unmount the 9P tree mounted under /n/<name>."}, {"name": "Up", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Move the keyboard to the pane above, and from a column's top pane to its tag."}, diff --git a/runtime/macos.zig b/runtime/macos.zig index 408915da..a5869753 100644 --- a/runtime/macos.zig +++ b/runtime/macos.zig @@ -103,7 +103,7 @@ pub const Image = extern struct { paper_bg: u32, }; -pub const Runtime = extern struct { +pub const Callbacks = extern struct { userdata: ?*anyopaque = null, wakeup: ?*const fn (?*anyopaque) callconv(.c) void = null, set_clipboard: ?*const fn (?*anyopaque, [*]const u8, usize) callconv(.c) void = null, @@ -250,7 +250,7 @@ const State = struct { io: std.Io, core: *pardes.Pardes, started: bool = false, - runtime: Runtime, + runtime: Callbacks, tag_cells: [pardes.MAX_TAG_LAYERS][]Cell = @splat(&.{}), layer_cells: [pardes.MAX_PANES][]Cell = @splat(&.{}), cells: []Cell = &.{}, @@ -290,7 +290,7 @@ const State = struct { var state: ?State = null; -export fn pardes_init(runtime: ?*const Runtime, cols_arg: u16, rows_arg: u16) c_int { +export fn pardes_init(runtime: ?*const Callbacks, cols_arg: u16, rows_arg: u16) c_int { if (state != null) return 1; // already up; deinit first initCore(runtime, cols_arg, rows_arg) catch |err| { log.err("init failed: {t}", .{err}); @@ -302,7 +302,7 @@ export fn pardes_init(runtime: ?*const Runtime, cols_arg: u16, rows_arg: u16) c_ /// The shell's gpa in a Debug build, as std.start's is for the others. var debug_gpa: std.heap.DebugAllocator(.{}) = .init; -fn initCore(runtime: ?*const Runtime, cols_arg: u16, rows_arg: u16) !void { +fn initCore(runtime: ?*const Callbacks, cols_arg: u16, rows_arg: u16) !void { // The allocator every other shell gets from std.start: a DebugAllocator // in Debug, libc's malloc otherwise. libc's measured at least as fast as // std.heap.smp_allocator everywhere and faster on MuPDF's page-sized @@ -2461,7 +2461,7 @@ test "pardes.h matches the Zig boundary" { try expectEqual(@sizeOf(c.pardes_image_s), @sizeOf(Image)); inline for (@typeInfo(Image).@"struct".field_names) |name| try expectEqual(@offsetOf(c.pardes_image_s, name), @offsetOf(Image, name)); - try expectEqual(@sizeOf(c.pardes_runtime_s), @sizeOf(Runtime)); + try expectEqual(@sizeOf(c.pardes_callbacks_s), @sizeOf(Callbacks)); try expectEqual(@as(u32, c.PARDES_COLOR_DEFAULT), color_default); try expectEqual(@as(u32, c.PARDES_COLOR_INDEXED), color_indexed); diff --git a/runtime/main.zig b/runtime/main.zig index 2b600d63..448dfa57 100644 --- a/runtime/main.zig +++ b/runtime/main.zig @@ -753,7 +753,7 @@ const Word = struct { /// Its group: the first key after the leader, else what it is. fn group(w: Word) []const u8 { if (std.mem.indexOf(u8, w.doc, " (addon ") != null and std.mem.endsWith(u8, w.doc, ")")) return "addon"; - if (pardes.config.Runtime.find(w.name) != null) return "setting"; + if (pardes.config.Settings.find(w.name) != null) return "setting"; if (std.meta.stringToEnum(pardes.builtins.registry.Builtin(), w.name)) |b| if (pardes.config.leader_path.get(b)) |p| switch (p[0]) { 'f' => return "file", 'c' => return "column", diff --git a/test/macos_e2e.swift b/test/macos_e2e.swift index 74a03200..38d27808 100644 --- a/test/macos_e2e.swift +++ b/test/macos_e2e.swift @@ -51,7 +51,7 @@ private struct ScriptError: Error { } /// What the three C callbacks reach through `userdata`. A class, because a C -/// function pointer cannot capture: a pointer the runtime struct carries is the +/// function pointer cannot capture: a pointer the callbacks struct carries is the /// only way back into Swift state. private final class Host { /// Set by `wakeup`, which runs on a pty reader thread. Nothing else in the @@ -168,7 +168,7 @@ private final class Driver: PardesViewDelegate { message: "the view measured \(got.cols)x\(got.rows) cells, not the \(cols)x\(rows) the script asked for") } - var runtime = pardes_runtime_s( + var runtime = pardes_callbacks_s( userdata: Unmanaged.passUnretained(host).toOpaque(), wakeup: { ud in // A pty reader thread. One flag and out — see Host.woke. diff --git a/test/output.zig b/test/output.zig index 38e8ba0d..4b9e7678 100644 --- a/test/output.zig +++ b/test/output.zig @@ -549,7 +549,7 @@ test "a window's setting builtins (TaglineSize, Font) reach the report DumpConfi defer font_arena.deinit(); var chosen_font: ?[]const u8 = null; var buf: [512]u8 = undefined; - for (config.Runtime.settings) |setting| { + for (config.Settings.settings) |setting| { // The view's own (a terminal's takes no window's words). if (!setting.enabled(builtins.viewCapabilities(p))) continue; const command: []const u8 = switch (setting.action) { diff --git a/test/snapshots/find.golden b/test/snapshots/find.golden index 6c3bc950..4825d1dc 100644 --- a/test/snapshots/find.golden +++ b/test/snapshots/find.golden @@ -30,7 +30,7 @@ |32: /tmp/pardes-snap/find/cwd/sub/ZQMARK-beta.txt Del |33: 1 beta body == snap promoted grid=120x41 cursor=7,33 -|22: +Search 2/3 Save Unattach Del +|22: +Search 2/3 Save Undock Del |32: /tmp/pardes-snap/find/cwd/sub/ZQMARK-beta.txt Save Term Collapse Follow Del == snap nomatch grid=120x41 cursor=11,14 |13: ^ +Search 0 Del @@ -43,7 +43,7 @@ == snap cancel grid=120x41 cursor=7,3 |13: |14: -|22: +Search 2/3 Save Unattach Del +|22: +Search 2/3 Save Undock Del |23: Find zqm |24: zqmark-alpha.txt |25: sub/ZQMARK-beta.txt diff --git a/test/snapshots/fsearch.golden b/test/snapshots/fsearch.golden index e923cb58..71a9900a 100644 --- a/test/snapshots/fsearch.golden +++ b/test/snapshots/fsearch.golden @@ -71,7 +71,7 @@ |8: 6 MARK b |9: ^ +Search 2/3 Del == snap landed grid=180x31 cursor=10,8 -|9: +Search 2/3 Save Unattach Del +|9: +Search 2/3 Save Undock Del == snap n grid=180x31 cursor=10,8 |7: 9 l9 |8: 10 MARK c diff --git a/test/snapshots/grep.golden b/test/snapshots/grep.golden index 1d8d21ad..52633372 100644 --- a/test/snapshots/grep.golden +++ b/test/snapshots/grep.golden @@ -36,7 +36,7 @@ |14: 1 deep |15: 2 TARGET inside sub == snap opened-hit grid=180x31 cursor=12,15 -|9: +Search 3/3 Save Unattach Del +|9: +Search 3/3 Save Undock Del |13: /tmp/pardes-snap/grep/cwd/sub/b.txt Save Term Collapse Follow Del == snap nomatch grid=180x31 cursor=11,15 |14: ^ +Search 0 Del diff --git a/test/snapshots/lookrange.golden b/test/snapshots/lookrange.golden index 92b619e4..c677fb8f 100644 --- a/test/snapshots/lookrange.golden +++ b/test/snapshots/lookrange.golden @@ -69,7 +69,7 @@ |15: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-11 #e5eee5,#0d1410, 12-149 #f5f7ee,#3c614a, |16: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-6 #616f64,#0d1410,b 7-10 #f5f7ee,#3c614a, 11-149 #f5f7ee,#0d1410, == snap hit1 grid=150x31 cursor=17,15 -|21: +Search 2/2 Save Unattach Del +|21: +Search 2/2 Save Undock Del |22: /NEEDLE |23: r.txt:7:4 gg NEEDLE gg |24: r.txt:8:6 hhhh NEEDLE diff --git a/test/snapshots/lsp-client.golden b/test/snapshots/lsp-client.golden index 44b16309..42c378d1 100644 --- a/test/snapshots/lsp-client.golden +++ b/test/snapshots/lsp-client.golden @@ -26,5 +26,5 @@ |19: /tmp/pardes-snap/lsp-client/cwd/+Preview Del |20: 1 == snap gr-opened grid=100x25 cursor=21,6 -|13: +Search 2/3 Save Unattach Del +|13: +Search 2/3 Save Undock Del == snap gr-back grid=100x25 cursor=21,7 diff --git a/test/snapshots/lsprelpath.golden b/test/snapshots/lsprelpath.golden index 36f411ef..964f0286 100644 --- a/test/snapshots/lsprelpath.golden +++ b/test/snapshots/lsprelpath.golden @@ -29,7 +29,7 @@ | 1 == snap abslook grid=100x35 cursor=21,27 |3: 1 const shade = @import("../shade.zig"); -|16: +Search 1/2 Save Unattach Del +|16: +Search 1/2 Save Undock Del |26: /tmp/pardes-snap/lsprelpath/cwd/shade.zig Save Term Collapse Follow TreeContext Def Refs Del |27: 1 pub const Shade = enum { |28: 2 verdigris, @@ -103,7 +103,7 @@ | 1 == snap sublook grid=100x35 cursor=20,28 |3: 1 const tint = @import("inner/tint.zig"); -|16: +Search 1/2 Save Unattach Del +|16: +Search 1/2 Save Undock Del |26: /tmp/pardes-snap/lsprelpath/cwd/sub/inner/tint.zig Save Term Collapse Follow TreeContext Def Refs |27: Del |28: 1 pub const Tint = enum { diff --git a/test/snapshots/stepgrain.golden b/test/snapshots/stepgrain.golden index 1b7d3245..9af17689 100644 --- a/test/snapshots/stepgrain.golden +++ b/test/snapshots/stepgrain.golden @@ -84,5 +84,5 @@ |18: 0-0 d,#608269, 1-149 d,#0d1410, |22: 0-1 d,#496656, 2-32 #b2c3b8,#1d2824, 33-46 #d3b0d9,#1d2824, 47-149 #b2c3b8,#1d2824, == snap blank-opened grid=150x31 cursor=7,23 -|12: +Search 1/1 Save Unattach Del +|12: +Search 1/1 Save Undock Del |22: /tmp/pardes-snap/stepgrain/cwd/two words.txt Save Term Collapse Follow Del |
