aboutsummaryrefslogtreecommitdiffstats
path: root/src/config.c
diff options
context:
space:
mode:
authoruser <user@clank>2026-10-09 12:24:23 +0200
committeruser <user@clank>2026-10-09 12:31:53 +0200
commit3a0825c6890eff566307c0eaad809cdbcf854efd (patch)
treeadd5cc5d6e731bce8dcffe96fa92d64c84052143 /src/config.c
parentpanes: the focus a closed tab left behind (diff)
downloadslosh-3a0825c6890eff566307c0eaad809cdbcf854efd.tar.gz
slosh-3a0825c6890eff566307c0eaad809cdbcf854efd.tar.xz
slosh-3a0825c6890eff566307c0eaad809cdbcf854efd.zip
tab bar: a sidebar that fits the terminal, and gives up the edge last
`tab_bar_width` was a reservation: the configured columns came off the screen whatever the screen was, and the only fallback was all the way back to the top row. On a narrow terminal that is chrome displacing the thing it is chrome for, and the jump to the top moves every target you were aiming at. It is a ceiling now. app_tab_bar_cols takes the app, because the answer depends on the terminal and not only on the config: held to the columns left after a pane's collapse width, and to a third of the screen, and narrowed rather than dropped. TAB_BAR_FIT (14) is the narrowest width this code will invent on its own -- a config that asks for less is taken at its word -- and 0 means there is no room for a sidebar at all, which is the one case that still falls back on top. Height counts too, which it did not before: a sidebar spends a row per tab, so a wide but short terminal runs out of list before it runs out of screen, and a tab with no row is not clipped, it is unreachable. tab_bar_min_rows is that floor. Not when the top strip could not seat them either -- moving them would gain nothing, so the side you configured stands. All of it is re-derived per frame, like the layout, so a resize moves the bar and nothing remembers that it did. test_tab_bar also stops depending on where the suite is run from. An unnamed tab borrows the basename of its focused pane's cwd, so eight checks read `tests` under `make test` (which cds there) and `slosh` from the repository root, where they failed. They are about padding, alignment and the index, not about that derivation, so they name the tab first -- by id, since `set-name` takes 0 for the focused *pane* only. 147 checks, green from either directory.
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/config.c b/src/config.c
index 60eb711..b2f3243 100644
--- a/src/config.c
+++ b/src/config.c
@@ -997,7 +997,9 @@ void config_defaults(config_t *c) {
c->tab_bar_side = TAB_BAR_TOP;
c->tab_bar_index = TAB_INDEX_RIGHT;
/* Wide enough for " 12:a-real-name " plus a bell; narrow enough that a
- * 100-column terminal keeps a working layout beside it. */
+ * 100-column terminal keeps a working layout beside it. A ceiling rather
+ * than a reservation -- app_tab_bar_cols narrows it to fit a smaller
+ * screen, so this is the width you get when there is room for it. */
c->tab_bar_width = 18;
/* 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
@@ -1771,7 +1773,7 @@ char *config_render(const config_t *c) {
"tab_bar_index \"%s\" // the sidebar's number at its far edge, or "
"1:name\n",
c->tab_bar_index == TAB_INDEX_RIGHT ? "right" : "prefix");
- cb_add(&b, "tab_bar_width %u // columns a sidebar takes\n",
+ cb_add(&b, "tab_bar_width %u // columns a sidebar takes, at most\n",
c->tab_bar_width);
if (c->tab_pad_top == c->tab_pad_right &&
c->tab_pad_top == c->tab_pad_bottom && c->tab_pad_top == c->tab_pad_left)