summaryrefslogtreecommitdiff
path: root/src/pardes.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-24 13:55:12 -0300
committerGabriel Schneider <[email protected]>2026-10-24 16:02:22 -0300
commit4c635f357adb95235429d8905b8598a2643b4f3b (patch)
treedd4f4f9b7e66b2bad71a0d30541c2b4ce2bb4cb9 /src/pardes.zig
parent95321ab082a750f4f1ef26d9bb21d1d3d01274f2 (diff)
downloadpardes-4c635f357adb95235429d8905b8598a2643b4f3b.tar.gz
pardes-4c635f357adb95235429d8905b8598a2643b4f3b.zip
drag 2/3: a pane's or column's grip let go past the window's edge opens it in a new window (Handover.zig)
Diffstat (limited to 'src/pardes.zig')
-rw-r--r--src/pardes.zig24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/pardes.zig b/src/pardes.zig
index 79a2e5a5..99231a57 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -28,6 +28,7 @@ pub const Macro = @import("Macro.zig");
pub const Pipe = @import("Pipe.zig");
pub const Stream = @import("Stream.zig");
pub const Finder = @import("Finder.zig");
+pub const Handover = @import("Handover.zig");
pub const colors = @import("colors.zig");
pub const Theme = colors.Theme;
pub const themes = colors.themes;
@@ -495,6 +496,7 @@ test {
_ = @import("Stream.zig");
_ = @import("Finder.zig");
_ = @import("Tables.zig");
+ _ = @import("Handover.zig");
}
pub const Builtin = builtins.registry.Builtin();
@@ -3600,6 +3602,10 @@ pub const Mouse = struct {
/// them there. A row of text never is one; a terminal, with no rule,
/// resizes by the grip.
rule_above: bool = false,
+ /// A release past the window's edge: a grip let go there carries its
+ /// pane or column out of the window (Handover.zig). col and row are
+ /// still the last cell inside.
+ outside: bool = false,
};
pub const Key = struct {
@@ -3690,6 +3696,9 @@ pub const Event = union(enum) {
pointer_leave,
/// The window gained (true) or lost the host's keyboard focus.
focus: bool,
+ /// How the host's handover `seq` went (Handover.finish): taken by `to`,
+ /// or `failure` says why not. Borrowed for the step.
+ handed: struct { seq: u32, to: []const u8 = "", failure: ?[]const u8 = null },
tick,
};
@@ -3737,6 +3746,9 @@ pub const Effect = union(enum) {
/// Start the disk search of this generation (Stream.start) on a worker
/// posting into the shell's inbox.
search: struct { gen: u32 },
+ /// Carry `handover.bytes`, the dump of handover `seq`, to another
+ /// window, answering with `handed` (Handover.zig).
+ hand_over: struct { seq: u32 },
/// Write what an Edit's `w` took (`Pipe.writes`), in order.
edit_write,
watch: struct { pane: u8, on: bool, mode: WatchMode = .reconcile },
@@ -4319,6 +4331,10 @@ pub const Options = struct {
tty_toggle: u21 = config.tty_toggle_default,
/// load a dump of another instance instead of spawning shells (acme -l)
load_path: ?[]const u8 = null,
+ /// `--geometry=WxH[+X+Y]`: a pixel shell's window size, and where it
+ /// goes when the display lets it say (a pane carried out of another
+ /// window opens one as big as that, Handover.zig).
+ geometry: ?[]const u8 = null,
nested: bool = false,
/// The core of a `--detach` session (detached/server.zig): it has no
/// terminal of its own, so Attach there is refused with why.
@@ -4394,6 +4410,8 @@ pub const Pardes = struct {
/// The finder column, where query panes stack with SearchPlace column
/// (Finder.zig).
finder: Finder = .{},
+ /// A pane or column on its way to another window (Handover.zig).
+ handover: Handover = .{},
global_tag: Text = .{ .what = .workspace },
// derived each sync
rects: [MAX_PANES]Rect = @splat(.{}),
@@ -4955,6 +4973,7 @@ pub const Pardes = struct {
for (p.spawn_dirs) |d| if (d) |dir| gpa.free(dir);
p.pipe.deinit(gpa);
p.stream.deinit(gpa);
+ p.handover.deinit(gpa);
p.locations_cache.deinit(p.tree_sitter_gpa);
p.fs.deinit(gpa);
p.shell_rows.reset(gpa);
@@ -5858,6 +5877,10 @@ pub const Pardes = struct {
p.update(.{ .pipe_resp = .{ .id = q.id, .success = false, .outputs = &.{} } }),
// No workers here (a test, a board): it runs on the loop.
.search => |q| if (v.search) |f| f(p.host.ctx, q.gen) else Stream.runHere(p, q.gen),
+ // No windows here (a test, the tty): it stays.
+ .hand_over => |h| if (v.hand_over) |f| {
+ if (p.handover.bytes) |bytes| f(p.host.ctx, h.seq, bytes);
+ } else p.update(.{ .handed = .{ .seq = h.seq, .failure = "no other windows here" } }),
.edit_write => {
// Each write takes the bytes `w` took when it ran: the text
// as it was before the Edit's changes.
@@ -6133,6 +6156,7 @@ pub const Pardes = struct {
.pinch => |scale| p.ov_pinch_scale = scale,
.touch_scroll => |delta| p.ov_touch_scroll_delta = delta,
.focus => |focused| p.window_focused = focused,
+ .handed => |h| p.handover.finish(p, h.seq, h.to, h.failure),
.pointer_leave => {
p.pointer_inside = false;
p.pointer_body_hit = null;