summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-08-02 18:35:29 -0300
committerGabriel Schneider <[email protected]>2026-08-10 09:17:07 -0300
commit45f152b2de946aa7c7ed5ffe37d07b0930dfc38b (patch)
tree0b18f8484163596414b20ee75a13fb508babc4ec /src/gui
parent35cecf26b06cf50d9827056da99d883ca975c39b (diff)
downloadpardes-45f152b2de946aa7c7ed5ffe37d07b0930dfc38b.tar.gz
pardes-45f152b2de946aa7c7ed5ffe37d07b0930dfc38b.zip
add New builtin for an empty temporary file in the calling column
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/gui.zig11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/gui/gui.zig b/src/gui/gui.zig
index 7d2a8cf1..0069164d 100644
--- a/src/gui/gui.zig
+++ b/src/gui/gui.zig
@@ -25,6 +25,7 @@ const crt = @import("crt.zig");
const fonts = @import("fonts.zig"); // the Font builtin's half of the seam
const is_emscripten = builtin.os.tag == .emscripten;
+const temp_file = if (is_emscripten) struct {} else @import("../temp_file.zig");
pub const c = @cImport({
@cDefine("SDL_DISABLE_OLD_NAMES", "1");
@@ -2486,6 +2487,14 @@ fn drainEffects(
// from the bytes we just put there so it reads as "no change"
if (watches[sf.pane]) |*w| w.hash = std.hash.Wyhash.hash(0, f.content);
},
+ .new_file => |request| {
+ var path_buf: [4096:0]u8 = undefined;
+ const made = temp_file.create(&path_buf) orelse continue;
+ if (core.openNewFile(request.pane, request.serial, made.path))
+ made.adopt()
+ else
+ made.discard();
+ },
.write_dump => {
const out = core.dump_out orelse continue;
var pbuf: [1024:0]u8 = undefined;
@@ -2554,7 +2563,7 @@ fn drainEffectsWeb(core: *pardes.Pardes, gpa: std.mem.Allocator, g: *Gui) void {
.open_link => |url| openLinkWeb(gpa, url.slice()),
// nothing to spawn/write/resize/save/dump into, and no filesystem to
// watch — all no-ops
- .spawn, .write, .resize_pty, .save_file, .write_dump, .lsp, .watch, .quit => {},
+ .spawn, .write, .resize_pty, .save_file, .new_file, .write_dump, .lsp, .watch, .quit => {},
};
}