summaryrefslogtreecommitdiff
path: root/src/pardes.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-24 13:11:11 -0300
committerGabriel Schneider <[email protected]>2026-10-24 13:27:54 -0300
commit9299281492d63e549ab274034efb59ab4e9d96f6 (patch)
tree326e55f07d422adf7fd4e9037107c22bfe70ae6e /src/pardes.zig
parent1af098381515fbe3a4fe678cd023c7fd74418ae1 (diff)
downloadpardes-9299281492d63e549ab274034efb59ab4e9d96f6.tar.gz
pardes-9299281492d63e549ab274034efb59ab4e9d96f6.zip
Search converge 6/6: SearchPlace column, the finder column at the right edge holding the query panes; n/N in a frozen query pane; the design doc
Diffstat (limited to 'src/pardes.zig')
-rw-r--r--src/pardes.zig18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/pardes.zig b/src/pardes.zig
index 3ccfee5f..6f30d6ca 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -26,6 +26,7 @@ pub const Registers = @import("Registers.zig");
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 colors = @import("colors.zig");
pub const Theme = colors.Theme;
pub const themes = colors.themes;
@@ -490,6 +491,7 @@ test {
_ = @import("Query.zig");
_ = @import("Names.zig");
_ = @import("Stream.zig");
+ _ = @import("Finder.zig");
}
pub const Builtin = builtins.registry.Builtin();
@@ -4386,6 +4388,9 @@ pub const Pardes = struct {
col_tags: [MAX_COLS]Text = @splat(.{ .what = .column }),
col_serial: [MAX_COLS]u32 = @splat(0),
next_column_serial: u32 = 1,
+ /// The finder column, where query panes stack with SearchPlace column
+ /// (Finder.zig).
+ finder: Finder = .{},
global_tag: Text = .{ .what = .workspace },
// derived each sync
rects: [MAX_PANES]Rect = @splat(.{}),
@@ -5225,14 +5230,19 @@ pub const Pardes = struct {
pub fn newColumn(p: *Pardes, from_id: usize) void {
// An empty window (Delcol took the last column): its first column.
if (layout.firstColumn(p)) |c| return tagline.enterHeader(p, c);
- const col = p.keyboardColumn(from_id) orelse return;
+ const keyboard_col = p.keyboardColumn(from_id) orelse return;
+ // Asked from the finder: the new column goes left of it, so the
+ // finder stays at the edge as wide.
+ const in_finder = p.finder.column(p) == keyboard_col;
+ const before_finder = in_finder and keyboard_col == 0;
+ const col = if (in_finder and keyboard_col > 0) keyboard_col - 1 else keyboard_col;
// A trial: laying it out gives it a serial (layout.compute), which a
// refusal takes back. Every other column has its own already, so
// the counter as it is now is the trial's to return to.
for (0..p.ncol) |k| _ = layout.columnSerial(p, k);
const unspent = p.next_column_serial;
// Said, not silently nothing: "no space" is 9ns's word for ENOSPC.
- const c = layout.insertColumnUnannounced(p, col, false) orelse {
+ const c = layout.insertColumnUnannounced(p, col, before_finder) orelse {
var said: [96]u8 = undefined;
return p.reportFailure(from_id, if (p.ncol >= MAX_COLS)
std.fmt.bufPrint(&said, "Newcol: no space for a column: {d} max", .{MAX_COLS}) catch "Newcol: no space for a column"
@@ -7224,9 +7234,11 @@ pub const Pardes = struct {
const beside = if (emptied) |c| p.besideColumn(c, p.rects[id]) else null;
layout.removePane(p, id);
p.panes[id] = null;
+ // The finder's last pane takes the column with it.
+ const finder_gone = if (emptied) |c| p.finder.emptied(p, c) else false;
if (p.active != id) return;
p.active = gainer orelse beside orelse p.anyPane() orelse return p.quitEmpty();
- if (emptied) |c| if (!p.header_focus) tagline.enterHeader(p, c);
+ if (emptied) |c| if (!finder_gone and !p.header_focus) tagline.enterHeader(p, c);
}
/// Delcol: close column `col` and every pane in it.