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/builtins.zig | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/builtins.zig') diff --git a/src/builtins.zig b/src/builtins.zig index 578a60dd..b89952cd 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -345,6 +345,17 @@ pub const Save = struct { } }; +/// Ask the native shell for an atomically-created empty temporary file. The +/// pane and its lifetime serial are the placement token: by the time IO +/// finishes another column may be active, or this slot may even have been +/// reused, and neither is permission to put the document somewhere else. +pub const New = struct { + pub fn run(c: Ctx) void { + if (c.p.freeSlot() == null) return; + c.p.emit(.{ .new_file = .{ .pane = @intCast(c.id), .serial = c.pane.serial } }); + } +}; + pub const Newcol = struct { pub fn run(c: Ctx) void { const free = c.p.freeSlot() orelse return; -- cgit v1.3