aboutsummaryrefslogtreecommitdiffstats
path: root/src/app.c
diff options
context:
space:
mode:
authoruser <user@clank>2026-08-14 22:26:30 +0200
committeruser <user@clank>2026-08-14 22:26:30 +0200
commit83f569c162e94609f35a33eb126af4244aa5f68f (patch)
treef0404ecf1cfa850423a3c25036ad4f416859b78e /src/app.c
parentsl0ppty: shaders can be loaded from shared libraries (diff)
downloadslosh-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/app.c')
-rw-r--r--src/app.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/app.c b/src/app.c
index be707c7..785d028 100644
--- a/src/app.c
+++ b/src/app.c
@@ -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.