summaryrefslogtreecommitdiff
path: root/src/Output.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-30 06:25:57 -0300
committerGabriel Schneider <[email protected]>2026-10-30 12:45:02 -0300
commitcb2688602b3f668790a9c35890973af80143697f (patch)
tree384f147de8b8971471b59ed29879ede6e35a1ea2 /src/Output.zig
parent11e67e636b39b9b2901ec5cc49a13a012088650f (diff)
downloadpardes-cb2688602b3f668790a9c35890973af80143697f.tar.gz
pardes-cb2688602b3f668790a9c35890973af80143697f.zip
gui: the window a replica client (pardes-gui --attach=<socket>:<name> and <host>:<name>, as the tty's, far through ssh as amort's: its blobs by hash and its stream in zstd) and a window session serving replicas (a terminal's client or a window's): the client feeds its replica what its window does, read over its own view (views.within) and applied after, draws its view between steps, takes the stream on its own reader and rejoins as the tty's does (replica.Link, the client's half shared with it, the far path's Have with it); the session takes clients at its step boundary, one person's input a wait, a client's view no window of its own, its font and opacity answers taped; a client says its frontend first (Event.frontend, in wire 16 beside the far word) and the tty and window builds step alike (one desktop semantics: each has the other's words, which a view takes by its own frontend, builtins.registry.here); a check asked 300 ms after the last input and check, not per wake; test/daemon.py --window-clients
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/Output.zig')
-rw-r--r--src/Output.zig22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/Output.zig b/src/Output.zig
index 29e49180..359db1cf 100644
--- a/src/Output.zig
+++ b/src/Output.zig
@@ -905,7 +905,7 @@ fn openStepped(p: *Pardes, id: usize, from: Origin, content: []u8) !void {
look.armLookWalk(p, free);
}
-fn helpContent(gpa: std.mem.Allocator, prefix: []const u8) ![]u8 {
+fn helpContent(p: *const Pardes, gpa: std.mem.Allocator, prefix: []const u8) ![]u8 {
const full_header = "pardes builtins, and how to run each:\nSPC and its keys, a chord, a button, the\ntopbar - or the name, executed anywhere.\n\n";
const group_header = "pardes builtins under SPC";
const calls_help = "\nCallstack: static caller chains,\nwith signatures and clickable call sites.\nCallers / Callees: one direction at a time.\n";
@@ -934,8 +934,10 @@ fn helpContent(gpa: std.mem.Allocator, prefix: []const u8) ![]u8 {
}
for (pardes.builtin_rows) |row| {
// a path-less builtin filters as the empty path: in the full listing
- // (which starts with nothing) and out of every group
+ // (which starts with nothing) and out of every group; a window's own
+ // word is none in a terminal's view
if (!std.mem.startsWith(u8, row.path orelse "", prefix)) continue;
+ if (!builtins.registry.here(p, row.cmd)) continue;
try w.print("{s}\n", .{row.line});
}
if (show_calls_help) try w.writeAll(calls_help);
@@ -966,21 +968,23 @@ fn helpContent(gpa: std.mem.Allocator, prefix: []const u8) ![]u8 {
}
pub fn openHelp(p: *Pardes, id: usize, prefix: []const u8) !void {
- const content = try helpContent(p.gpa, prefix);
+ const content = try helpContent(p, p.gpa, prefix);
// content is handed off unfreed on purpose: openRead adopts it or frees
// it, and nothing between the alloc above and this line can fail.
return openRead(p, id, .{ .cmd = .Help }, prefix, content);
}
test "full Help renders builtin rows, a call hierarchy guide, then language keys" {
- const content = try helpContent(std.testing.allocator, "");
+ const core = try Pardes.init(std.testing.allocator, .{ .tty_only = true });
+ defer core.deinit();
+ const content = try helpContent(core, std.testing.allocator, "");
defer std.testing.allocator.free(content);
// FIRST blank line: the end of the header (the footer opens with one too)
const body = content[(std.mem.indexOf(u8, content, "\n\n") orelse
return error.MissingHelpHeader) + 2 ..];
var lines = std.mem.splitScalar(u8, body, '\n');
- for (pardes.builtin_rows) |row|
+ for (pardes.builtin_rows) |row| if (builtins.registry.here(core, row.cmd))
try std.testing.expectEqualStrings(row.line, lines.next() orelse
return error.MissingBuiltinHelpRow);
// The short call guide disambiguates the three related commands.
@@ -995,7 +999,7 @@ test "full Help renders builtin rows, a call hierarchy guide, then language keys
return error.MissingLanguageKeys);
try std.testing.expect(std.mem.indexOf(u8, body, "\ngd gD gy gi gr goto: definition,\n") != null);
// The language group also explains call commands, without the motion footer.
- const group = try helpContent(std.testing.allocator, "l");
+ const group = try helpContent(core, std.testing.allocator, "l");
defer std.testing.allocator.free(group);
try std.testing.expect(std.mem.indexOf(u8, group, "language keys") == null);
try std.testing.expect(std.mem.indexOf(u8, group, "Callstack: static caller chains") != null);
@@ -1013,13 +1017,13 @@ pub fn openConfig(p: *Pardes, id: usize) !void {
.locations = located.written(),
.default_dump_dir = if (host_fs) (pardes.dump.defaultDirectory(&dir_buf) orelse "") else "",
.startup_config_path = p.opts.startup_config_path,
- .platform = @tagName(pardes.platform),
+ .platform = builtins.viewPlatform(p),
.theme_name = p.theme().name,
.theme_file = pardes.colors.loadedThemeFile(p),
.compiled_default_shell = config.defaultShell(),
.hover_delay_frames = config.look_preview_delay_frames,
.native_images = p.native_images,
- .capabilities = builtins.capabilities,
+ .capabilities = builtins.viewCapabilities(p),
.state = &p.settings,
});
const content = try out.toOwnedSlice();
@@ -1061,7 +1065,7 @@ pub fn openEffectCode(p: *Pardes, id: usize, argument: []const u8) !void {
.transition, .scene => {},
else => return error.NotAnEffect,
}
- if (!setting.enabled(builtins.capabilities)) return error.EffectUnavailable;
+ if (!setting.enabled(builtins.viewCapabilities(p))) return error.EffectUnavailable;
// Without -Dembed-sources the paths would name nothing this build can open.
if (!limits.embedded_sources) return error.EffectUnavailable;
const paths = effect_sources.forSetting(setting) orelse