diff options
| author | Gabriel Schneider <[email protected]> | 2026-08-02 18:35:29 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-08-10 09:17:07 -0300 |
| commit | 45f152b2de946aa7c7ed5ffe37d07b0930dfc38b (patch) | |
| tree | 0b18f8484163596414b20ee75a13fb508babc4ec /src/builtins.zig | |
| parent | 35cecf26b06cf50d9827056da99d883ca975c39b (diff) | |
| download | pardes-45f152b2de946aa7c7ed5ffe37d07b0930dfc38b.tar.gz pardes-45f152b2de946aa7c7ed5ffe37d07b0930dfc38b.zip | |
add New builtin for an empty temporary file in the calling column
Diffstat (limited to 'src/builtins.zig')
| -rw-r--r-- | src/builtins.zig | 11 |
1 files changed, 11 insertions, 0 deletions
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; |
