diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-24 16:06:18 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-24 16:10:40 -0300 |
| commit | 3b9ad2f510267d7be7280386cc95bb41a6e71308 (patch) | |
| tree | 9eb4f6d50415a6e27ad4b3af58547ed84270e99e /src | |
| parent | 186549aa873ee39cfc148c96456c610a1b50c252 (diff) | |
| download | pardes-3b9ad2f510267d7be7280386cc95bb41a6e71308.tar.gz pardes-3b9ad2f510267d7be7280386cc95bb41a6e71308.zip | |
merge: a pane a grip carried to another window is not kept as a closed pane (Store.away while Handover.finish closes it): it is open there, so Panes does not offer it back here; the dump golden gains drag's .carried = null
Diffstat (limited to 'src')
| -rw-r--r-- | src/Handover.zig | 6 | ||||
| -rw-r--r-- | src/Store.zig | 9 |
2 files changed, 12 insertions, 3 deletions
diff --git a/src/Handover.zig b/src/Handover.zig index 3acfc4e6..ced9baf0 100644 --- a/src/Handover.zig +++ b/src/Handover.zig @@ -110,6 +110,9 @@ pub fn finish(h: *Handover, p: *Pardes, seq: u32, to: []const u8, failure: ?[]co return p.reportFailure(at, std.fmt.bufPrint(&buf, "handover: {s}; the pane stays here", .{why}) catch "handover failed; the pane stays here"); } var kept: usize = 0; + // Moved, not closed: the other window has them now (Store.away). + p.store.away = true; + defer p.store.away = false; for (h.serials[0..h.count], h.revisions[0..h.count]) |serial, revision| { const id = p.paneBySerial(serial) orelse continue; // closed with its owner const pane = p.panes[id].?; @@ -443,6 +446,9 @@ test "a grip let go past the window's edge dumps its pane alone, and closes it o const serial = p.panes[0].?.serial; p.update(.{ .handed = .{ .seq = p.handover.seq, .to = "pardes/1" } }); try std.testing.expect(p.paneBySerial(serial) == null); + // Open in the other window, so not one of this session's closed panes + // (Store.zig): Panes does not offer it back here. + try std.testing.expect(p.store.closedBySerial(serial) == null); p.sync(); try std.testing.expectEqual(@as(usize, 1), p.col_n[layout.findPane(p, other).?.col]); } diff --git a/src/Store.zig b/src/Store.zig index e06c55e5..5e47d695 100644 --- a/src/Store.zig +++ b/src/Store.zig @@ -93,6 +93,9 @@ loaded: bool = false, pending: std.ArrayList(u8) = .empty, /// This session's closed panes, oldest first. closed: std.ArrayList(Closed) = .empty, +/// The panes closing now went to another window (Handover.finish): open +/// there, they are no closed panes of this session, so none is kept. +away: bool = false, fn clockNs() i128 { var ts: std.c.timespec = .{ .sec = 0, .nsec = 0 }; @@ -488,10 +491,10 @@ fn frame(gpa: std.mem.Allocator, out: *std.ArrayList(u8), kind: u8, parts: []con /// Pane `id`, about to close, kept as a record: what it was (a one-pane /// Dump) and where (its column, its rows, what it was attached to). Null /// for a pane that is no pane of the user's: a query pane, a preview, one -/// made and refused in the same step (never announced), or one whose dump -/// fails or is too big. `close` finishes it once its rows have gone. +/// carried to another window (`away`), one made and refused in the same +/// step (never announced), or one whose dump fails or is too big. `close` finishes it once its rows have gone. pub fn keep(s: *Store, p: *Pardes, id: usize) ?Kept { - _ = s; + if (s.away) return null; const pane = p.panes[id] orelse return null; if (pane.fs.unannounced or pane.query != null) return null; if (pane.file) |f| if (f.output) |o| if (o.from == .preview) return null; |
