diff options
| author | user <user@clank> | 2026-08-14 22:26:30 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-14 22:26:30 +0200 |
| commit | 83f569c162e94609f35a33eb126af4244aa5f68f (patch) | |
| tree | f0404ecf1cfa850423a3c25036ad4f416859b78e /src | |
| parent | sl0ppty: shaders can be loaded from shared libraries (diff) | |
| download | slosh-83f569c162e94609f35a33eb126af4244aa5f68f.tar.gz slosh-83f569c162e94609f35a33eb126af4244aa5f68f.tar.xz slosh-83f569c162e94609f35a33eb126af4244aa5f68f.zip | |
sl0ppty: the new-tab button is a bare +, and yours to choose
It read "+tab" because of this, in the code, right above it:
Not a bare "+": the frame already has one, for splitting a pane. Two
verbs that look identical is a UI bug the fork shipped and noticed.
That was true when it was written and has not been since f2f3d67, which
removed the frame's "+" when the border became the button. The collision it
was avoiding no longer exists, and the word was left explaining itself to
nobody -- while every other affordance in this UI is a bare mark: _ # x on a
frame, and a hint under the pointer for anyone who wants the word.
So: "+", padded to three cells, because their own comment applies -- a
one-cell target is a thing you miss with a mouse.
Also configurable, as `newtab_mark`, which it should have been already: it
was the only mark here that was not (zoom_mark, zoom_on_mark, close_mark,
min_mark, bell_mark all are). Try "[+]" or "new" if you disagree; a session
picks it up on save.
Four tests were asserting the literal "+tab". Three of them only needed the
new string, but two were using it to *locate* the button -- bar.index("+tab")
-- which is exactly the mistake of asserting something incidental: what the
button says is now config, and a test that spells it out fails the day
somebody changes their mind. They look it up through the hit list now, which
is what they meant.
test_no_more_plus keeps the invariant that makes the bare mark safe, and now
says so: there is exactly one "+" in the UI, so it means one thing. If one
ever returns to a frame, that button needs its word back.
Diffstat (limited to 'src')
| -rw-r--r-- | src/app.c | 28 | ||||
| -rw-r--r-- | src/config.c | 3 | ||||
| -rw-r--r-- | src/config.h | 3 |
3 files changed, 27 insertions, 7 deletions
@@ -2559,14 +2559,28 @@ static void draw_tab_strip(app_t *a, screen_t *s) { x = (uint16_t)(x + w); } - /* Not a bare "+": the frame already has one, for splitting a pane. Two - * verbs that look identical is a UI bug the fork shipped and noticed. */ - if (x + 6 < right) { - uint16_t w = screen_text(s, x, y, " +tab ", TAB_IDLE, NO_COLOR, 0); - if (ptr_on(a, x, y, w, 1)) - screen_text(s, x, y, " +tab ", TAB_HOVER, NO_COLOR, ATTR_BOLD); - hit_add(&s->hits, x, y, w, 1, "newtab"); + /* A bare mark, spaced like the frame's own buttons rather than spelled out. + * It used to read "+tab", because a pane frame carried a "+" for splitting + * and two verbs that look identical is a UI bug the fork shipped. That "+" + * went when the border became the button, so the collision it was avoiding + * no longer exists and the word was left explaining itself to nobody. + * + * Padded to three cells for the same reason the frame's buttons are: a + * one-cell target is a thing you miss with a mouse. What it does is said by + * the hint under the pointer, which is where every other one-character + * affordance here says it. */ + { + char btn[24]; + snprintf(btn, sizeof btn, " %s ", CFG.newtab_mark); + uint16_t bw = (uint16_t)(cells(CFG.newtab_mark) + 2); + if (bw > 2 && x + bw <= right) { + uint16_t w = screen_text(s, x, y, btn, TAB_IDLE, NO_COLOR, 0); + if (ptr_on(a, x, y, w, 1)) + screen_text(s, x, y, btn, TAB_HOVER, NO_COLOR, ATTR_BOLD); + hit_add(&s->hits, x, y, w, 1, "newtab"); + } } + } /* The space between two of a split's children, or false if they are flush. diff --git a/src/config.c b/src/config.c index 2b80a18..80d9936 100644 --- a/src/config.c +++ b/src/config.c @@ -177,6 +177,7 @@ void config_defaults(config_t *c) { 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, "_"); + snprintf(c->newtab_mark, sizeof c->newtab_mark, "+"); c->bell_indicator = true; snprintf(c->bell_mark, sizeof c->bell_mark, "\u2022"); c->keep_dead = true; @@ -400,6 +401,8 @@ bool config_load(config_t *c, const char *path, char *err, size_t errcap) { if (cm) snprintf(c->close_mark, sizeof c->close_mark, "%s", cm); const char *mm = kdl_arg(kdl_child(root, "min_mark"), 0, NULL); if (mm) snprintf(c->min_mark, sizeof c->min_mark, "%s", mm); + const char *nt = kdl_arg(kdl_child(root, "newtab_mark"), 0, NULL); + if (nt) snprintf(c->newtab_mark, sizeof c->newtab_mark, "%s", nt); c->keep_dead = kdl_arg_bool(kdl_child(root, "keep_dead"), 0, c->keep_dead); c->bell_indicator = kdl_arg_bool(kdl_child(root, "bell_indicator"), 0, c->bell_indicator); diff --git a/src/config.h b/src/config.h index f8b799c..4be4ae0 100644 --- a/src/config.h +++ b/src/config.h @@ -97,6 +97,9 @@ typedef struct { * whitespace to the gap beside it and looks further away than its * neighbours, which is what an en dash did here. */ char zoom_mark[16], zoom_on_mark[16], close_mark[16], min_mark[16]; + /* The new-tab button at the end of the strip. Drawn with a space each side, + * so a one-character mark is still a three-cell target. */ + char newtab_mark[16]; bool bell_indicator; /* What to draw. A short string rather than a fixed glyph: the obvious * choice is an emoji bell, and emoji are drawn two columns wide by many |
