summaryrefslogtreecommitdiff
path: root/core/Band.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-25 06:20:03 -0300
committerGabriel Schneider <[email protected]>2026-11-25 06:20:03 -0300
commitea9a19700cc1c0bc22c08b1d31d7a62e5853b802 (patch)
tree58ddd9ef63f447b7517f2d1a75dec74d0931ed10 /core/Band.zig
parent5c897d00fe064cf8463ef76ea804b0aff6b62f0a (diff)
downloadpardes-ea9a19700cc1c0bc22c08b1d31d7a62e5853b802.tar.gz
pardes-ea9a19700cc1c0bc22c08b1d31d7a62e5853b802.zip
Pick, layout, Core, Band: the band's height: a picker's from its list at open, four rows at least, 40 % of its column at most, never moved by typing; the body keeps 60 % of its pane and six rows, borrowed from its column, and the band gives way before the body drops under six (walk UI polish P1, UX DESIGN.md D6, C8): a picker's band was as tall as its list (three hits, three rows; no cap), so a short list's band was a sliver and a long one took a short pane's body down to four rows (shot 04-L: four body rows of 18); now Pick.bandRows is min(11, max(4, what the source has), 40 % of the rows of the host's column: its panes' rows, which a borrow only moves between them, so the height never changes while typing), the rows fewer than it leaving the band's ground (and its spines) under them; layout.floorRows keeps a band's pane its band and a body of one and a half times what is above it (60 % of the pane) and six rows at least (Band.body_rows), borrowed from the column's other panes as before; Core.sync's band takes what leaves the body six rows, so a column too short for 60 % shrinks the band, never the body under six; TEST FIRST: Pick.zig "a picker's band is sized from its list at open, 4 rows at least, and typing never moves it" (two files: four rows, the same after `zzq` with nothing matching; on the parent two rows), Band.zig "a band keeps its pane's body 60 % of the pane, borrowed from its column; where the column has not the rows, the band gives way before the body drops under 6" (three panes in 40 rows: the body 60 % of the pane; in 12 rows the band shorter than it wants, the body six), the borrow test's body six rows (was four); core-test 1068/1239 (171 skipped); process-test: find, fsearch, lsp regenerated and read: each picker band four rows where its list has two or three (find's two files, fsearch's three places, lsp's three symbols), the rows under the list the band's ground with the spines on through it, the body that much lower; a user saw a picker's band change size with its source, and a short pane's body crushed
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE
Diffstat (limited to 'core/Band.zig')
-rw-r--r--core/Band.zig35
1 files changed, 33 insertions, 2 deletions
diff --git a/core/Band.zig b/core/Band.zig
index 07c2f83d..e34b6a49 100644
--- a/core/Band.zig
+++ b/core/Band.zig
@@ -73,6 +73,8 @@ pub const max_spines = 12;
pub const min_width = 24;
/// A doc's rows, the fewest a band with one has.
const doc_rows = 4;
+/// The body rows a band leaves its pane at least: it gives way first (UX D6).
+pub const body_rows = 6;
/// A level's rows past which it flows into two columns.
const one_column = 9;
@@ -635,7 +637,35 @@ test "SPC Down unrolls the level into a band under the tag's text, the body push
try std.testing.expect(!p.view().tag_state.unrolled);
}
-test "a pane whose body would drop below four rows under its band borrows them from its column" {
+test "a band keeps its pane's body 60 % of the pane, borrowed from its column; where the column has not the rows, the band gives way before the body drops under 6" {
+ const Key = pardes.Key;
+ const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 120, .rows = 40 });
+ defer p.deinit();
+ _ = try p.setTestFile("one\n");
+ const top = p.view().active;
+ p.newScratchBelow(top);
+ const low = p.view().active;
+ p.newScratchBelow(low);
+ p.view().active = low;
+ p.sync();
+ p.update(.{ .key = .{ .cp = ' ' } });
+ p.update(.{ .key = .{ .cp = Key.down } });
+ const pane = p.panes[low].?;
+ const r = p.view().rects[low];
+ try std.testing.expect(pane.band_rows >= doc_rows);
+ try std.testing.expect(@as(u32, r.h -| pane.tag_rows) * 5 >= @as(u32, r.h) * 3);
+ p.update(.{ .key = .{ .cp = Key.escape } });
+ // A window of 12 rows: the band shrinks, the body keeps 6.
+ p.update(.{ .resize = .{ .cols = 120, .rows = 12 } });
+ p.update(.{ .key = .{ .cp = ' ' } });
+ p.update(.{ .key = .{ .cp = Key.down } });
+ p.sync();
+ const short = p.view().rects[low];
+ try std.testing.expect(short.h -| pane.tag_rows >= 6 or pane.band_rows == 0);
+ try std.testing.expect(pane.band_rows < Band.takes(p, low));
+}
+
+test "a pane whose body would drop below six rows under its band borrows them from its column" {
const Key = pardes.Key;
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 120, .rows = 24 });
defer p.deinit();
@@ -652,7 +682,8 @@ test "a pane whose body would drop below four rows under its band borrows them f
const pane = p.panes[low].?;
const r = p.view().rects[low];
try std.testing.expect(r.h > before);
- try std.testing.expect(r.h -| pane.tag_rows >= 4);
+ // Its body six rows at least (UX D6): a column too short for 60 %.
+ try std.testing.expect(r.h -| pane.tag_rows >= 6);
// No pane dims out of rest (UX D9): the others look as at rest.
var frame = std.heap.ArenaAllocator.init(std.testing.allocator);
defer frame.deinit();