aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoruser <user@clank>2026-08-15 23:35:58 +0200
committeruser <user@clank>2026-08-15 23:35:58 +0200
commitdabeb8eb2da8e87c52ad068173bf52204f3b76d6 (patch)
tree5cadbd8d91ae5a21946080e030116c4d61f4eb0b
parentsl0ppty: say what the config could not honour (diff)
downloadslosh-dabeb8eb2da8e87c52ad068173bf52204f3b76d6.tar.gz
slosh-dabeb8eb2da8e87c52ad068173bf52204f3b76d6.tar.xz
slosh-dabeb8eb2da8e87c52ad068173bf52204f3b76d6.zip
sl0ppty: one family of marks for the frame's buttons
⊟ ⊞ ⊠ away, bigger, gone ⊟ ⊡ ⊠ ...and while it is already filling the tab `_ # x` said what they did only if you already knew, and `*` for a zoomed pane was the weakest of the four: nothing about an asterisk says "put it back". So there are four marks now instead of three and a half, with the unzoom state getting one of its own. ASCII was there for a reason, and the reason survives: the cells are even, but a glyph that does not fill its own cell hands the slack to the gap beside it, and how much it hands over depends on the font -- which is why box-drawing and block characters were tried here and looked unevenly spaced. Four copies of *the same box* answer that better than four unrelated glyphs did: whatever a font does with the box, it does four times, and only the interior changes. Minus for away, plus for bigger, dot for back to normal, times for gone. Single width, checked in a real frame rather than assumed -- the row still closes on its corner and each button is still measured rather than booked, so the hits land where the glyphs are. Not emoji, which many terminals draw two columns wide while chrome here is booked as one. Two tests were pinning the old glyphs by hand (`line.rindex("x")` for the cheatsheet's close button, `"*" in line` for the zoom state). They read them out of `sl0ppty --dump-config` now, which is generated from the code: picking a nicer mark later cannot leave a test asserting a glyph nothing draws.
-rw-r--r--config/config.kdl23
-rw-r--r--src/config.c14
-rw-r--r--tests/test_help.py21
-rw-r--r--tests/test_zoom.py22
4 files changed, 60 insertions, 20 deletions
diff --git a/config/config.kdl b/config/config.kdl
index 1c2bd88..fb16c86 100644
--- a/config/config.kdl
+++ b/config/config.kdl
@@ -144,20 +144,23 @@ version_banner true
pane_buttons true
-// Plain single-width ASCII, after box-drawing and block characters were each
-// tried and each looked unevenly spaced: the cells are even, but a glyph that
-// does not fill its own cell hands that space to the gap beside it, and how
-// much it hands over depends on the font. ASCII of a similar weight sidesteps
-// the question. Emoji are the worst case -- many terminals draw them two
-// columns wide while chrome here is booked as one.
+// One family, four interiors: minus for away, plus for bigger, dot for back to
+// normal, times for gone. ASCII was here first, and for a good reason -- the
+// cells are even but a glyph that does not fill its own cell hands the slack to
+// the gap beside it, so box-drawing and block characters both looked unevenly
+// spaced. Four copies of the same box answer that better than four unrelated
+// glyphs did: whatever the font does with the box, it does four times.
+//
+// Single width, and never emoji: many terminals draw those two columns wide
+// while chrome here is booked as one, which shifts everything after them.
//
// A mark may be more than one character; the button is measured rather than
// assumed, so "[]" and "][" work if you prefer them. Put the character itself
// here; this file has no \u escape.
-zoom_mark "#"
-zoom_on_mark "*"
-close_mark "x"
-min_mark "_"
+zoom_mark "⊞" // click to fill the tab with this pane
+zoom_on_mark "⊡" // ...and this is what it says while it is filling it
+close_mark "⊠"
+min_mark "⊟" // into the strip along the bottom, still running
// The new-tab button at the end of the tab strip. Drawn with a space on each
// side, so a one-character mark is still a three-cell target -- a one-cell
diff --git a/src/config.c b/src/config.c
index a6c63a9..421a1cd 100644
--- a/src/config.c
+++ b/src/config.c
@@ -347,10 +347,16 @@ void config_defaults(config_t *c) {
c->hints = true;
c->version_banner = true;
c->pane_buttons = true;
- snprintf(c->zoom_mark, sizeof c->zoom_mark, "#");
- snprintf(c->zoom_on_mark, sizeof c->zoom_on_mark, "*");
- snprintf(c->close_mark, sizeof c->close_mark, "x");
- snprintf(c->min_mark, sizeof c->min_mark, "_");
+ /* One family, four interiors: minus, plus, dot, times. The lesson that put
+ * ASCII here in the first place was about *evenness* -- a glyph that does not
+ * fill its own cell hands the slack to the gap beside it -- and four copies of
+ * the same box answer that better than four unrelated glyphs did, while still
+ * saying which verb is which. Single width, and not emoji: many terminals
+ * draw those two columns wide while chrome here is booked as one. */
+ snprintf(c->zoom_mark, sizeof c->zoom_mark, "\u229e"); /* ⊞ fill the tab */
+ snprintf(c->zoom_on_mark, sizeof c->zoom_on_mark, "\u22a1"); /* ⊡ and put it back */
+ snprintf(c->close_mark, sizeof c->close_mark, "\u22a0"); /* ⊠ close */
+ snprintf(c->min_mark, sizeof c->min_mark, "\u229f"); /* ⊟ into the strip */
snprintf(c->newtab_mark, sizeof c->newtab_mark, "+");
c->bell_indicator = true;
snprintf(c->bell_mark, sizeof c->bell_mark, "\u2022");
diff --git a/tests/test_help.py b/tests/test_help.py
index 69088c7..d4300bd 100644
--- a/tests/test_help.py
+++ b/tests/test_help.py
@@ -5,10 +5,12 @@ It is built from the bindings the config actually has, not from a list of what
the defaults are — a cheatsheet that can disagree with the keyboard is worse
than none, and it would disagree the first time somebody rebound a key.
"""
+import re
+import subprocess
import sys
import tempfile
-from harness import Session, check, report
+from harness import BIN, Session, check, report
SH = ["/bin/sh", "-c", 'printf "\\033]2;p\\007"; stty raw -echo; cat']
@@ -20,6 +22,19 @@ def cfg(text):
return f.name
+def close_mark():
+ """The mark the close button is drawn with, read from the binary rather than
+ written down here: `--dump-config` is generated from the code, so changing
+ the default cannot leave this test asserting a glyph nothing draws."""
+ out = subprocess.run([BIN, "--dump-config"], capture_output=True,
+ text=True).stdout
+ m = re.search(r'close_mark "(.+)"', out)
+ return m.group(1) if m else "x"
+
+
+MARK = close_mark()
+
+
def open_help(s):
s.send(r"\x01?")
s.settle()
@@ -116,7 +131,7 @@ def test_the_close_button_can_be_seen_without_hovering_it():
snap = open_help(s)
y, line = modal_top(snap)
check("the modal has a top border", y is not None, snap.screen())
- x = line.rindex("x")
+ x = line.rindex(MARK)
fg, bg = style(snap, x, y)
check("the close button is not its own background", fg != bg,
f"fg {fg} bg {bg}")
@@ -129,7 +144,7 @@ def test_the_close_button_closes_it():
s.settle()
snap = open_help(s)
y, line = modal_top(snap)
- s.click(line.rindex("x"), y)
+ s.click(line.rindex(MARK), y)
s.settle()
check("clicking the button puts it away",
"split into columns" not in s.snapshot().screen())
diff --git a/tests/test_zoom.py b/tests/test_zoom.py
index 285269d..d4dca17 100644
--- a/tests/test_zoom.py
+++ b/tests/test_zoom.py
@@ -7,14 +7,30 @@ layout being recomputed, that it cannot outlive the pane it names, and that it
is per tab.
"""
import os
+import re
+import subprocess
import sys
import tempfile
-from harness import Session, check, report
+from harness import BIN, Session, check, report
SH = ["/bin/sh", "-c", 'printf "\\033]2;p\\007"; stty raw -echo; cat']
+def mark(name):
+ """A chrome mark as the binary currently draws it. Read from
+ `--dump-config`, which is generated from the code, rather than written down
+ here -- a test that pins a glyph starts failing the day somebody picks a
+ nicer one, and says nothing useful when it does."""
+ out = subprocess.run([BIN, "--dump-config"], capture_output=True,
+ text=True).stdout
+ m = re.search(name + r' "(.+)"', out)
+ return m.group(1) if m else "?"
+
+
+ZOOM, ZOOM_ON = mark("zoom_mark"), mark("zoom_on_mark")
+
+
def cfg(text):
f = tempfile.NamedTemporaryFile("w", suffix=".kdl", delete=False)
f.write(text)
@@ -76,7 +92,7 @@ def test_the_button_toggles_and_says_which_way():
s.click(b["x"] + 1, b["y"])
s.settle(20)
check("clicking it zooms", len(visible(s)) == 1, str(s.panes()))
- check("and the mark says so", "*" in s.snapshot().line(2),
+ check("and the mark says so", ZOOM_ON in s.snapshot().line(2),
repr(s.snapshot().line(2)[-14:]))
# The button moved: the pane it belongs to just became the whole tab.
@@ -85,7 +101,7 @@ def test_the_button_toggles_and_says_which_way():
s.settle(20)
check("clicking it again puts it back", len(visible(s)) == 2,
str(s.panes()))
- check("and the mark goes back too", "#" in s.snapshot().line(2),
+ check("and the mark goes back too", ZOOM in s.snapshot().line(2),
repr(s.snapshot().line(2)[-14:]))