diff options
| author | user <user@clank> | 2026-09-09 20:49:18 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-09-09 20:49:18 +0200 |
| commit | 2d006fdc97df7eecde0f49f94f24e096bcdebe28 (patch) | |
| tree | b0e45b3b4d2828ab119d645fed2350004909a9c5 | |
| parent | pane: shift consumed by the character is consumed, tell the encoder (diff) | |
| download | slosh-2d006fdc97df7eecde0f49f94f24e096bcdebe28.tar.gz slosh-2d006fdc97df7eecde0f49f94f24e096bcdebe28.tar.xz slosh-2d006fdc97df7eecde0f49f94f24e096bcdebe28.zip | |
compact: the minimised bar sits below a shared line, not on the border
A compact pane owns no border cells -- its bottom border is the shared
line one cell outside its rect. With panes minimised, that cell was the
bar's top row: the chips sat directly on the bottom panes' content,
reading as frames cut into the pane. Classic panes carry their own
border row and never collided.
The layout now reserves one extra row above the bar in compact, and
draw_compact_lines strokes the boundary there: it joins the outer ring
with real junctions, a divider from above ends into it, and a focused
bottom pane re-strokes its stretch like any shared line.
| -rw-r--r-- | src/app_draw.c | 15 | ||||
| -rw-r--r-- | src/app_layout.c | 11 | ||||
| -rw-r--r-- | tests/test_compact.py | 43 |
3 files changed, 67 insertions, 2 deletions
diff --git a/src/app_draw.c b/src/app_draw.c index a3221e8..9a2c89e 100644 --- a/src/app_draw.c +++ b/src/app_draw.c @@ -2210,6 +2210,21 @@ void draw_compact_lines(app_t *a, screen_t *s) { if (!ar.x || !ar.y) return; /* no room for a ring: no lines to share */ stroke_ring(s, ar, FRAME_IDLE, 0, true); + /* The line between the tree and the minimised bar: the bottom panes' + * shared border, on the row the layout reserved for it (a compact pane + * owns no border cells, so without this row the chips sat directly on the + * panes' content). Drawn before the divider end-extensions, so a vertical + * divider from above ends into it as a ┴ the same way it meets the ring, + * and re-strokable by a focused bottom pane like any shared line. */ + rect_t bar = cur(a)->min_bar; + if (bar.h) { + uint16_t ly = (uint16_t)(bar.y - 1); + uint16_t x0 = (uint16_t)(ar.x - 1), x1 = (uint16_t)(ar.x + ar.w); + for (uint16_t x = x0; x <= x1; x++) + stroke(s, x, ly, (uint8_t)((x > x0 ? BX_L : 0) | (x < x1 ? BX_R : 0)), + FRAME_IDLE, 0, true); + } + /* The dividers' own cells first, their end-extensions after: an end only * ever joins a line that is already there — the ring, or a perpendicular * divider — which is what makes the junction glyphs, and what keeps a diff --git a/src/app_layout.c b/src/app_layout.c index 1b15f47..db43056 100644 --- a/src/app_layout.c +++ b/src/app_layout.c @@ -482,8 +482,15 @@ void layout(app_t *a) { bool no_room = false; cur(a)->min_bar = (rect_t){0, 0, 0, 0}; if (nmin) { - if (r.h >= (uint16_t)(MIN_PANE_ROWS + 5)) { - tree_r.h = (uint16_t)(r.h - 3); + /* Compact spends one row more: a compact pane's bottom border is the + * shared line one cell *outside* its rect, and with the bar directly + * below, that cell is the chips' top row -- the chips sat on the border. + * The extra row gives the line somewhere to live; draw_compact_lines + * strokes it. A classic pane carries its own bottom border and needs no + * such row. */ + uint16_t bar_rows = CFG.compact ? 4 : 3; + if (r.h >= (uint16_t)(MIN_PANE_ROWS + 2 + bar_rows)) { + tree_r.h = (uint16_t)(r.h - bar_rows); cur(a)->min_bar = (rect_t){r.x, (uint16_t)(r.y + r.h - 3), r.w, 3}; } else { no_room = true; diff --git a/tests/test_compact.py b/tests/test_compact.py index 4d15131..c1217dc 100644 --- a/tests/test_compact.py +++ b/tests/test_compact.py @@ -300,6 +300,48 @@ def test_compact_float_keeps_the_classic_frame(): s.settle(30) +def test_compact_min_bar_sits_below_a_shared_line(): + """The minimised bar and the bottom panes share no border row. A compact + pane's bottom border is the shared line one cell outside its rect; the + layout reserves that row above the bar and draw_compact_lines strokes it, + ring junctions included. Without it the chips sat directly on the panes' + content -- "the minimised rectangles overlap the bottom pane's border".""" + with Session(SH, cols=90, rows=24, config=COMPACT) as s: + s.settle(30) + s.key("\\\\") + s.settle(30) + s.key("-") + s.settle(30) + s.key("m") + s.settle(30) + snap = s.snapshot() + bar = min( + (h for h in snap.hits if h["action"].startswith("focus:") and h["h"] == 3), + key=lambda h: h["y"], + default=None, + ) + check("a chip is in the hit list", bar is not None, str(snap.hits)) + if not bar: + return + line = snap.line(bar["y"] - 1) + check( + "the row above the chips is the panes' bottom border", + line.startswith("\u251c") and line.rstrip().endswith("\u2524"), + repr(line), + ) + check( + "the divider from above ends into it as a junction", + "\u2534" in line, + repr(line), + ) + low = max(p["y"] + p["h"] for p in s.panes() if p["h"]) + check( + "no pane reaches the line's row", + low <= bar["y"] - 1, + f"panes end {low}, line at {bar['y'] - 1}", + ) + + def test_compact_is_a_config_key(): import subprocess @@ -334,5 +376,6 @@ if __name__ == "__main__": test_compact_focus_ring_wears_the_frame_colour() test_compact_dead_pane_epitaph_overlays_the_last_row() test_compact_float_keeps_the_classic_frame() + test_compact_min_bar_sits_below_a_shared_line() test_compact_is_a_config_key() sys.exit(report()) |
