diff options
| author | user <user@clank> | 2026-09-10 16:17:12 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-09-10 16:17:12 +0200 |
| commit | 4d00529a56c90b0506f28817809528ef31a1c499 (patch) | |
| tree | 8edd8987fe039be4b1e12d7065990cf51274c370 | |
| parent | sidebar: framed like a pane, and in compact mode framed *with* it (tab_bar_ch... (diff) | |
| download | slosh-4d00529a56c90b0506f28817809528ef31a1c499.tar.gz slosh-4d00529a56c90b0506f28817809528ef31a1c499.tar.xz slosh-4d00529a56c90b0506f28817809528ef31a1c499.zip | |
sidebar: tab_bar_pad back to 0, now that the frame is the separation
The row of air was standing in for a boundary the sidebar did not have.
tab_bar_chrome gave it one, and a blank row inside the frame on top of
that reads as a gap nobody asked for. The knob stays for a bare sidebar
(tab_bar_chrome false), and for anyone who wants room at the top for a
borderless window's own buttons.
With the default at 0, Y0 in the tests is the unpadded first row and a
pad of N moves the list exactly N rows down from it, which is what the
pad test now says rather than carrying the default around in its
arithmetic.
| -rw-r--r-- | docs/panes.md | 2 | ||||
| -rw-r--r-- | src/config.c | 9 | ||||
| -rw-r--r-- | tests/test_tab_bar.py | 29 |
3 files changed, 22 insertions, 18 deletions
diff --git a/docs/panes.md b/docs/panes.md index 913d2cb..329e017 100644 --- a/docs/panes.md +++ b/docs/panes.md @@ -55,7 +55,7 @@ The strip of tabs sits along the top by default. It does not have to: ```kdl tab_bar_side "left" // or "right"; "top" is the default tab_bar_width 18 // columns the sidebar takes -tab_bar_pad 1 // blank rows above the first tab +tab_bar_pad 0 // blank rows above the first tab tab_bar_chrome true // frame it like a pane ``` diff --git a/src/config.c b/src/config.c index b5cdcc3..cea9177 100644 --- a/src/config.c +++ b/src/config.c @@ -923,10 +923,11 @@ void config_defaults(config_t *c) { /* Wide enough for " 12:a-real-name " plus a bell; narrow enough that a * 100-column terminal keeps a working layout beside it. */ c->tab_bar_width = 18; - /* One row of air by default: a list that starts in the very corner reads - * as cramped, and in compact mode the row lines the first tab up with the - * pane content inside the ring rather than with the ring's top line. */ - c->tab_bar_pad = 1; + /* None by default: tab_bar_chrome's top line is the separation the air was + * standing in for, and a blank row inside the frame on top of it reads as + * a gap nobody asked for. Still there for a bare sidebar, or for anyone + * who wants room at the top for a borderless window's own buttons. */ + c->tab_bar_pad = 0; /* Three is enough for "the build, the tests, and one more thing" without a * chatty tab pushing the list off the bottom. */ c->tab_bar_status = 3; diff --git a/tests/test_tab_bar.py b/tests/test_tab_bar.py index 850192d..eab817a 100644 --- a/tests/test_tab_bar.py +++ b/tests/test_tab_bar.py @@ -28,10 +28,10 @@ RIGHT = _cfg(f'tab_bar_side "right"\ntab_bar_width {W}\n') BARE = _cfg(f'tab_bar_side "left"\ntab_bar_width {W}\ntab_bar_chrome false\n') # With tab_bar_chrome (the default) the frame takes a column each side and a -# row top and bottom: content runs x 1..16, and gap 1 + frame 1 + pad 1 puts -# the first tab on row 3. CX/CW/Y0 are that content box, so a geometry change +# row top and bottom: content runs x 1..16, and gap 1 + frame 1 + pad 0 puts +# the first tab on row 2. CX/CW/Y0 are that content box, so a geometry change # is one edit here rather than thirty coordinates below. -CX, CW, Y0 = 1, W - 2, 3 +CX, CW, Y0 = 1, W - 2, 2 SH = ["/bin/sh", "-c", "stty raw -echo; cat"] @@ -107,20 +107,22 @@ def test_right_sidebar_takes_the_other_edge(): def test_pad_pushes_the_list_down(): - pad = _cfg(f'tab_bar_side "left"\ntab_bar_width {W}\ntab_bar_pad 3\n') + # The default pad is 0, so Y0 is the unpadded first row and a pad of N + # moves the list exactly N rows down it. + n = 3 + pad = _cfg(f'tab_bar_side "left"\ntab_bar_width {W}\ntab_bar_pad {n}\n') with Session(SH, cols=90, rows=20, config=pad) as s: s.settle(30) snap = s.snapshot() - # Two rows further down than the default pad of 1. check( "the pad rows are not targets", - snap.hit_at(CX, Y0) is None and snap.hit_at(CX, Y0 + 1) is None, - f"{snap.hit_at(CX, Y0)} / {snap.hit_at(CX, Y0 + 1)}", + all(snap.hit_at(CX, Y0 + k) is None for k in range(n)), + str([snap.hit_at(CX, Y0 + k) for k in range(n)]), ) check( "the first tab starts below the pad", - snap.hit_at(CX, Y0 + 2) == "tab:1", - str(snap.hit_at(CX, Y0 + 2)), + snap.hit_at(CX, Y0 + n) == "tab:1", + str(snap.hit_at(CX, Y0 + n)), ) p = s.pane(0) check( @@ -288,15 +290,16 @@ def test_chrome_false_gives_the_columns_back(): with Session(SH, cols=90, rows=20, config=BARE) as s: s.settle(40) snap = s.snapshot() + # No frame row either, so the list starts on the gap's own row. check( "no frame: the list starts in the first column", - snap.hit_at(0, 2) == "tab:1", - str(snap.hit_at(0, 2)), + snap.hit_at(0, 1) == "tab:1", + str(snap.hit_at(0, 1)), ) check( "and the whole width is the target", - snap.hit_at(W - 1, 2) == "tab:1", - str(snap.hit_at(W - 1, 2)), + snap.hit_at(W - 1, 1) == "tab:1", + str(snap.hit_at(W - 1, 1)), ) |
