aboutsummaryrefslogtreecommitdiffstats
path: root/include
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 /include
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 'include')
-rw-r--r--include/app_internal.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/include/app_internal.h b/include/app_internal.h
index 40d169a..c6769d2 100644
--- a/include/app_internal.h
+++ b/include/app_internal.h
@@ -489,10 +489,13 @@ void walk_all(app_t *a, leaf_fn fn, void *ud);
uint16_t eff_gap(split_dir_t dir);
rect_t app_tab_area(app_t *a);
/* Where the tab bar lands this frame (TAB_BAR_*), and how many columns a
- * sidebar takes. The side is re-derived per frame: a screen too narrow for
- * the sidebar falls back to the top row. */
+ * sidebar takes. Both are re-derived per frame from the terminal's size: a
+ * sidebar narrows to fit a small screen, and one that can no longer seat
+ * either the panes or its own list of tabs falls back to the top row. The
+ * columns are 0 when there is no room for a sidebar at all; pass a NULL app
+ * to ask only what the config wants. */
int app_tab_bar_side(const app_t *a);
-uint16_t app_tab_bar_cols(void);
+uint16_t app_tab_bar_cols(const app_t *a);
void close_leaf(app_t *a, node_t *leaf);
node_t *first_leaf_of(node_t *n);
void focus_dir(app_t *a, int dx, int dy);