summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-20 13:32:36 -0300
committerGabriel Schneider <[email protected]>2026-11-20 13:52:46 -0300
commitd3f9f3775e2efbcb4d617afb4a18eaf5efa72e29 (patch)
tree57ed0f1eb2439d3b473d7b914cf871bff7478bf5 /core
parentce92a8c3da84c0bc4f5f2b56acf6e09fa42990f4 (diff)
downloadpardes-d3f9f3775e2efbcb4d617afb4a18eaf5efa72e29.tar.gz
pardes-d3f9f3775e2efbcb4d617afb4a18eaf5efa72e29.zip
may_wait: Fonts in a window's view of a terminal's build: the soak's 'client 2's input key stopped at fonts' was a window client (the soak's even clients are windows) of the tui build's session whose key ran Fonts (the key logged is Enter, a word taken under the cursor; the leader's SPC t f runs it too, config.zig, set wherever builtins.capabilities.font_picker, true on every desktop build: a window's view of a terminal's session has the window's words), whose list is the session's machine's fonts (Output.openFonts, tape site fonts): a far client may wait for it, as the window's build already lists; may_wait listed it only where pardes.platform == .gui; now Fonts where the build has the word (capabilities.font_picker) and Font <name> where its site is reachable (pardes.font_picker: exec.zig's Font is a window build's alone); FIRST the test: the walk of every word, on a terminal's build, walks the words again in a window's view (on the base: 'Fonts on file stopped at fonts', 1 unlisted); then the rows: shell-test's walk 12/12 (with Font gated as Fonts it said the row Font * stale: its gate is its site's)
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core')
-rw-r--r--core/replica.zig50
1 files changed, 35 insertions, 15 deletions
diff --git a/core/replica.zig b/core/replica.zig
index ff43203a..24d1ad21 100644
--- a/core/replica.zig
+++ b/core/replica.zig
@@ -6229,9 +6229,12 @@ const may_wait = [_]Wait{
.{ .what = "*", .on = .addon, .stop = "a kind's close", .why = "a kind's pane closed: its state let go on the session" },
.{ .what = "*", .on = .addon, .stop = "a kind's word", .why = "a word to a kind (a key it takes as one): its own state" },
.{ .what = "*", .on = .addon, .stop = "a kind's open", .why = "a kind's pane opened (`Life`): its state made on the session" },
-} ++ (if (pardes.platform == .gui) [_]Wait{
+} ++ (if (pardes.font_picker) [_]Wait{
// A window's view (the font words are a window's).
.{ .what = "Font *", .on = .any, .stop = "fonts", .why = "the session's machine's fonts, its disk" },
+} else [_]Wait{}) ++ (if (pardes.builtins.capabilities.font_picker) [_]Wait{
+ // ...and Fonts a terminal's build has too, which a window client of its
+ // session runs (exec.zig's Font, a window build's alone, does not).
.{ .what = "Fonts", .on = .any, .stop = "fonts", .why = "the session's machine's fonts, its disk" },
} else [_]Wait{});
@@ -6385,6 +6388,23 @@ const Walk = struct {
return what.len >= pattern.len - 1 and std.mem.startsWith(u8, what, pattern[0..star]) and std.mem.endsWith(u8, what, pattern[star + 1 ..]);
}
+ /// Every word, with a sample argument where one is required.
+ fn words(w: *Walk) !void {
+ var line: [128]u8 = undefined;
+ for (std.enums.values(pardes.builtins.registry.Builtin())) |b| {
+ const name = @tagName(b);
+ const arg: ?[]const u8 = for (walk_samples) |s| {
+ if (std.mem.eql(u8, s[0], name)) break s[1];
+ } else null;
+ if (pardes.builtins.registry.requiresArg(b) and arg == null) {
+ std.debug.print("may_wait: `{s}` requires an argument: give it one in walk_samples\n", .{name});
+ return error.NoSample;
+ }
+ const cmd = if (arg) |x| try std.fmt.bufPrint(&line, "{s} {s}", .{ name, x }) else name;
+ try w.try_(cmd, &.{.{ .command = cmd }});
+ }
+ }
+
/// The name of what stopped the inputs, "" when none did.
fn try_(w: *Walk, what: []const u8, evs: []const pardes.Event) !void {
const r = w.r;
@@ -6451,7 +6471,6 @@ test "a far client's every word and key, on a file's pane, a kind's and a shell'
var hit: [may_wait.len]bool = @splat(false);
var unlisted: u32 = 0;
var tried: u32 = 0;
- const Builtin = pardes.builtins.registry.Builtin();
const stands = [_]struct { On, ?usize }{ .{ .file, file }, .{ .kind, kind }, .{ .shell, shell }, .{ .shell_normal, shell } };
for (stands) |stand| {
const on, const at = stand;
@@ -6473,19 +6492,7 @@ test "a far client's every word and key, on a file's pane, a kind's and a shell'
try std.testing.expectEqual(id, r.core().view().active);
if (on == .shell) try std.testing.expect(pardes.Term.modes(r.core().panes[id].?.terminal).focus);
var w: Walk = .{ .r = r, .on = on, .seen = &seen, .hit = &hit };
- // Every word, with a sample argument where one is required.
- for (std.enums.values(Builtin)) |b| {
- const name = @tagName(b);
- const arg: ?[]const u8 = for (walk_samples) |s| {
- if (std.mem.eql(u8, s[0], name)) break s[1];
- } else null;
- if (pardes.builtins.registry.requiresArg(b) and arg == null) {
- std.debug.print("may_wait: `{s}` requires an argument: give it one in walk_samples\n", .{name});
- return error.NoSample;
- }
- const cmd = if (arg) |x| try std.fmt.bufPrint(&line, "{s} {s}", .{ name, x }) else name;
- try w.try_(cmd, &.{.{ .command = cmd }});
- }
+ try w.words();
// Every key, plain, with Ctrl and with Alt, and after each prefix.
var name_buf: [64]u8 = undefined;
for (walk_keys) |k| try w.try_(keyName(&name_buf, k), &.{.{ .key = k }});
@@ -6524,6 +6531,19 @@ test "a far client's every word and key, on a file's pane, a kind's and a shell'
unlisted += w.unlisted;
tried += w.tried;
}
+ // A terminal's build has the window's words too, which a window's view
+ // runs (a window client of its session; builtins.capabilities): its
+ // words walked again in one.
+ if (comptime pardes.builtins.desktop and pardes.platform != .gui) {
+ a.core.view().active = file;
+ _ = try a.local(.{ .frontend = .{ .windowed = true } });
+ const r = try joinedFresh(a);
+ defer r.deinit();
+ var w: Walk = .{ .r = r, .on = .file, .seen = &seen, .hit = &hit };
+ try w.words();
+ unlisted += w.unlisted;
+ tried += w.tried;
+ }
// A row is stale where every kind of pane was walked: with no terminal
// compiled in (core-test), a shell's rows stop nothing.
var stale: u32 = 0;