diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-05 23:16:22 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-05 23:58:31 -0300 |
| commit | 342650183a54dcfcdce6ca4d45d6fdf48b2d1c1c (patch) | |
| tree | 1ea95aa777d8ee643cfdaa8c188a8cb8ad1f27c5 /src/layout.zig | |
| parent | 3ebdbe26a14546f8e4ee06462850aad85f1c9646 (diff) | |
| download | pardes-342650183a54dcfcdce6ca4d45d6fdf48b2d1c1c.tar.gz pardes-342650183a54dcfcdce6ca4d45d6fdf48b2d1c1c.zip | |
settings #4, the three ways to place a search go, a query pane attached under the pane that asked, eight rows under its line 1 (Query.born_rows), the next search from that pane reusing it: SearchPlace, SearchPane and SearchRows, and with SearchPlace's column the finder column itself, src/Finder.zig and its reads (Core.zig's finder field, pardes.zig's export, views.zig's per-view and laid-out field names, panes.zig's emptied column, exec.placeNew's away column, and layout.zig's compute share, setColumnPairWidth, dropColumnUnannounced's heir and newColumn), with ctl's SearchRows check and the requiresArg and applySettingBuiltin arms; deleted tests: "SearchPlace column: query panes stack in a finder column at the right edge, nothing else moves after it opens, and it goes with its last pane" (Finder.zig) and the SearchPane new half of Query's "* seeds line 1" test; root_ctl's number refusal is Tab's range now; the guide says eight rows; a dump that kept the finder or the three fields loads without them; no golden changes; gates on tui: core-test 963/963, behaviour-test 241/241, unit-test 1479/1480, pane-test 171/172, snap all 105 scripts ok, process-test 0 of 37 failed; gui unit-test 1523/1524
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/layout.zig')
| -rw-r--r-- | src/layout.zig | 46 |
1 files changed, 8 insertions, 38 deletions
diff --git a/src/layout.zig b/src/layout.zig index 38841f59..1515b525 100644 --- a/src/layout.zig +++ b/src/layout.zig @@ -182,11 +182,6 @@ pub fn columnDrop(p: *const Pardes, source: usize, x: u16, grab: u16) ColumnDrop pub fn setColumnPairWidth(p: *Pardes, left: usize, left_width: u64) void { if (left + 1 >= p.ncol) return; const combined: u64 = p.col_w[left] + p.col_w[left + 1]; - // The finder's edge sets its share (Finder.dragWidth). - if (p.finder.column(p)) |fc| { - if (fc == left + 1) return p.finder.dragWidth(p, left, combined -| left_width); - if (fc == left) return p.finder.dragWidth(p, left + 1, left_width); - } // Too narrow for both to keep MINW: any split would squeeze one away. if (combined < 2 * @as(u64, config.MINW)) return; const width = std.math.clamp(left_width, config.MINW, @max(@as(u64, config.MINW), combined -| config.MINW)); @@ -468,11 +463,7 @@ pub fn dropColumn(p: *Pardes, c: usize) void { pub fn dropColumnUnannounced(p: *Pardes, c: usize) void { std.debug.assert(p.cols[c].n == 0); tagline.exitHeader(p); - // The finder's width was its share, no weight: nobody gets one, so the - // others are as wide as before it came. A column whose weight would go - // to the finder gives it to the column on the finder's other side. - const finder = p.finder.column(p); - const heir: ?usize = if (p.ncol <= 1 or finder == c) null else if (c > 0 and finder != c - 1) c - 1 else if (c + 1 < p.ncol and finder != c + 1) c + 1 else if (c > 1) c - 2 else if (c + 2 < p.ncol) c + 2 else null; + const heir: ?usize = if (p.ncol <= 1) null else if (c > 0) c - 1 else c + 1; if (heir) |h| p.cols[h].weight +|= p.cols[c].weight; p.col_tags[c].deinit(p.gpa); var j = c; @@ -703,7 +694,7 @@ pub fn restoreMinimaFrom(p: *Pardes, before: *const [MAX_PANES]Rect, before_min: compute(p); } -/// Whether new column `c` (Newcol's, the finder's) may stay. A narrower +/// Whether new column `c` (Newcol's) may stay. A narrower /// column wraps long tags onto more rows, which can leave a pane under its /// tag and two rows: each pane a column squeezed so (one that had its /// minimum `before`, `before_min`, not one dragged short) takes rows back @@ -1237,32 +1228,16 @@ pub fn compute(p: *Pardes) void { if (p.ncol == 0) return; keepGroups(p); for (0..p.ncol) |column| _ = columnSerial(p, column); - // The finder column is as wide as its share says (Finder.width), not - // by weight: the others share what it leaves by theirs, so it comes - // and goes and each of them keeps its proportion, none rounded off. - const finder = p.finder.column(p); - const finder_w: u16 = if (finder != null) p.finder.width(p) else 0; - const rest = p.screen_w -| finder_w; var wsum: u128 = 0; - var last_plain: usize = p.ncol; - for (0..p.ncol) |c| if (finder != c) { - wsum += p.cols[c].weight; - last_plain = c; - }; + for (0..p.ncol) |c| wsum += p.cols[c].weight; if (wsum == 0) wsum = 1; // Round cumulative boundaries so widths still sum to the available screen. var prefix: u128 = 0; - var offset: u16 = 0; for (0..p.ncol) |c| { - const x = offset + columnBoundary(rest, prefix, wsum); - const end: u16 = if (finder == c) end: { - offset = finder_w; - break :end x + finder_w; - } else end: { - prefix += p.cols[c].weight; - break :end if (c == last_plain) offset + rest else offset + columnBoundary(rest, prefix, wsum); - }; + const x = columnBoundary(p.screen_w, prefix, wsum); + prefix += p.cols[c].weight; + const end: u16 = if (c == p.ncol - 1) p.screen_w else columnBoundary(p.screen_w, prefix, wsum); const cw = end -| x; p.col_x[c] = x; p.col_w[c] = cw; @@ -1722,12 +1697,7 @@ pub fn columnBarHeight(p: *const Pardes) u16 { pub fn newColumn(p: *Pardes, from_id: usize) void { // An empty window (Delcol took the last column): its first column. if (firstColumn(p)) |c| return tagline.enterHeader(p, c); - const keyboard_col = keyboardColumn(p, 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; + const col = keyboardColumn(p, from_id) orelse return; // 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. @@ -1736,7 +1706,7 @@ pub fn newColumn(p: *Pardes, from_id: usize) void { const before_min = minima(p); const before = p.rects; // Said, not silently nothing: "no space" is 9ns's word for ENOSPC. - const c = insertColumnUnannounced(p, col, before_finder) orelse { + const c = insertColumnUnannounced(p, col, false) 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" |
