diff options
| author | Gabriel Schneider <[email protected]> | 2026-08-11 15:58:58 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-08-11 16:26:20 -0300 |
| commit | 4ca28745d774c232cd31a29c17878f19bbe24cf5 (patch) | |
| tree | face852acae5bc347e6bab2bb5cede501e0ce1d3 /src/builtins.zig | |
| parent | dedfdea43f0d6c7151c541284c81027969d89032 (diff) | |
| parent | 89d93d5e7348304bc7d8a148f9ad9c1beb200459 (diff) | |
| download | pardes-4ca28745d774c232cd31a29c17878f19bbe24cf5.tar.gz pardes-4ca28745d774c232cd31a29c17878f19bbe24cf5.zip | |
merge the macOS app branch: the AppKit shell, pixel attachments, live theming, and mupdf -Djpx
Three commits off 38e9919 (macos-app@upstream) merged into main's ghostty bump.
No textual conflicts, and two things the merge needed:
- nested.zig asked libc for fstatat. Darwin has it; on linux std.c declares it
`void` (glibc hides it behind a versioned symbol std cannot name), so the tty
build stopped at 'type void not a function'. statNoFollow keeps fstatat on
darwin and asks statx on linux for the same three fields, which is what this
file did before the branch generalized it to both platforms.
- .DS_Store rode along with a797a1a. Deleted, and .gitignore now says so.
linux: snap 86/86, unit-test, image-harness and mupdf-check green. nested.zig
also type-checks for aarch64-macos.
Diffstat (limited to 'src/builtins.zig')
| -rw-r--r-- | src/builtins.zig | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/src/builtins.zig b/src/builtins.zig index 3ccbdeed..f207ed9f 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -35,7 +35,7 @@ const config = @import("config.zig"); /// GUI-only file behind a comptime branch, the way look.zig imports the web's /// source archive: the tty and web builds evaluate the other arm and compile /// none of it. -const fonts = if (pardes.platform == .gui) @import("gui/fonts.zig") else struct {}; +const fonts = if (pardes.font_picker) @import("fonts.zig") else struct {}; /// What a builtin gets to act on. One bundle rather than five parameters /// because most builtins want two of them and zig rejects the unused rest. @@ -343,7 +343,7 @@ pub const Crt = struct { /// its next pass and re-rasters. Exactly the shape Restore already has. pub const Font = struct { pub const takes_arg = true; - pub const enabled = pardes.platform == .gui; + pub const enabled = pardes.font_picker; pub fn run(c: Ctx) void { if (comptime enabled) apply(c) else unreachable; } @@ -369,7 +369,7 @@ pub const Font = struct { /// them would mean the list wearing one on the way past. See fonts.monospaced. pub const FontSel = struct { pub const output: OutputTraits = .{ .name = config.fonts_buffer, .steps = true, .executes = true }; - pub const enabled = pardes.platform == .gui; + pub const enabled = pardes.font_picker; pub fn run(c: Ctx) void { if (comptime enabled) apply(c) else unreachable; } @@ -460,7 +460,13 @@ pub const Ascii = struct { pub const Save = struct { pub fn run(c: Ctx) void { // an output buffer has no file behind it — nothing to write - if (c.pane.file) |f| if (output_pane.fileTraits(f.output).saves) c.p.emit(.{ .save_file = .{ .pane = @intCast(c.id) } }); + if (c.pane.file) |*f| { + if (!output_pane.fileTraits(f.output).saves) return; + c.p.emit(.{ .save_file = .{ .pane = @intCast(c.id) } }); + // ...and this edit is now the one on disk. See File.saved_revision + // for why the mark goes here rather than after the write. + f.saved_revision = f.revision; + } } }; @@ -536,6 +542,22 @@ pub const Help = struct { } }; +/// Where pardes read its startup commands from — the path, printed into an +/// output buffer, `SPC f c` or the word executed anywhere. +/// +/// The one question docs/config.md cannot answer, because the answer depends +/// on the machine: XDG_CONFIG_HOME if it is set and absolute, else +/// ~/Library/Application Support/pardes on macOS and ~/.config/pardes +/// everywhere else. Printing it beats documenting it — the row is ordinary +/// text, so a right click on it opens the file, and when there is no file +/// there yet the path is still exactly what you needed to know. +pub const Config = struct { + pub const output: OutputTraits = .{ .name = config.config_buffer }; + pub fn run(c: Ctx) void { + output_pane.openConfig(c.p, c.id) catch |err| c.p.reportError(c.id, "config", err); + } +}; + // ---- search ---- // The two builtins that ASK for something — Find walks file NAMES under this |
