From 45f152b2de946aa7c7ed5ffe37d07b0930dfc38b Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Sun, 2 Aug 2026 18:35:29 -0300 Subject: add New builtin for an empty temporary file in the calling column --- src/gui/gui.zig | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/gui') 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 => {}, }; } -- cgit v1.3