aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoruser <user@clank>2026-09-10 15:41:16 +0200
committeruser <user@clank>2026-09-10 15:41:16 +0200
commit881c9b4a5c7352daf4861bff5902936e9746f9f5 (patch)
treed57b4eb8ceaf3675236c2c31924eb89d900d8dc7 /src
parenttabs: the strip can stand on its side (tab_bar_side left/right) (diff)
downloadslosh-881c9b4a5c7352daf4861bff5902936e9746f9f5.tar.gz
slosh-881c9b4a5c7352daf4861bff5902936e9746f9f5.tar.xz
slosh-881c9b4a5c7352daf4861bff5902936e9746f9f5.zip
sidebar: a row of air on top (tab_bar_pad), indicators under the labels' inset
One blank row above the first tab by default: a list starting in the very corner reads as cramped, and in compact mode the row lines the first tab up with the pane content inside the ring rather than with the ring's top line. The pad is where the drawing starts, not a layout fact -- the panes' rect is identical at pad 0 and pad 5, so tuning it repaints without reflowing anyone. The bottom indicators (pane count, prefix badge) move in one cell to sit under the labels' own leading space; flush at the edge column they read as misaligned on the left and collide with the compact ring's corner on the right.
Diffstat (limited to 'src')
-rw-r--r--src/app_draw.c19
-rw-r--r--src/config.c9
2 files changed, 22 insertions, 6 deletions
diff --git a/src/app_draw.c b/src/app_draw.c
index 372b2f5..2cf22d0 100644
--- a/src/app_draw.c
+++ b/src/app_draw.c
@@ -1960,25 +1960,32 @@ void draw_tab_sidebar(app_t *a, screen_t *s) {
uint16_t x = app_tab_bar_side(a) == TAB_BAR_LEFT
? 0
: (uint16_t)(s->cols > sw ? s->cols - sw : 0);
- uint16_t y = CFG.compact ? 0 : CFG.gap; /* same rule as the strip's row */
+ /* The strip's row rule, plus the configured air above the list. The pad is
+ * where the drawing starts, not a layout fact: the panes' rect is the same
+ * with pad 0 and pad 5, so tuning it repaints without reflowing anyone. */
+ uint16_t y = (uint16_t)((CFG.compact ? 0 : CFG.gap) + CFG.tab_bar_pad);
uint16_t limit = (uint16_t)(s->rows > (CFG.status_line ? 1 : 0)
? s->rows - (CFG.status_line ? 1 : 0)
: 0);
- /* Bottom rows first: what the horizontal strip keeps on its right. */
+ /* Bottom rows first: what the horizontal strip keeps on its right. Indented
+ * one cell to sit under the labels' own leading space -- at x exactly, the
+ * count reads flush against the screen edge on the left and against the
+ * compact ring's corner on the right. */
char info[64];
size_t np = app_pane_count(a);
snprintf(info, sizeof info, "%zu pane%s", np, np == 1 ? "" : "s");
- if (limit > y && (uint16_t)strlen(info) <= sw) {
+ if (limit > y && (uint16_t)(strlen(info) + 1) <= sw) {
limit--;
- screen_text(s, x, limit, info, TAB_COUNT, NO_COLOR, 0);
+ screen_text(s, (uint16_t)(x + 1), limit, info, TAB_COUNT, NO_COLOR, 0);
}
if (a->prefix) { /* the prefix is a mode: say so, and say which key */
char pfx[24];
config_chord_name(CFG.prefix_key, CFG.prefix_mods, pfx, sizeof pfx);
- if (limit > y && cells(pfx) <= sw) {
+ if (limit > y && (uint16_t)(cells(pfx) + 1) <= sw) {
limit--;
- screen_text(s, x, limit, pfx, PREFIX_FG, PREFIX_BG, ATTR_BOLD);
+ screen_text(s, (uint16_t)(x + 1), limit, pfx, PREFIX_FG, PREFIX_BG,
+ ATTR_BOLD);
}
}
diff --git a/src/config.c b/src/config.c
index 31ca0e1..d800696 100644
--- a/src/config.c
+++ b/src/config.c
@@ -923,6 +923,10 @@ void config_defaults(config_t *c) {
/* Wide enough for " 12:a-real-name " plus a bell; narrow enough that a
* 100-column terminal keeps a working layout beside it. */
c->tab_bar_width = 18;
+ /* One row of air by default: a list that starts in the very corner reads
+ * as cramped, and in compact mode the row lines the first tab up with the
+ * pane content inside the ring rather than with the ring's top line. */
+ c->tab_bar_pad = 1;
c->status_line = true;
/* Deliberately wider than the panes' own margin (gap * gap_aspect = 2), so
* the strip and the line read as chrome sitting outside the layout rather
@@ -1625,6 +1629,8 @@ char *config_render(const config_t *c) {
: "top");
cb_add(&b, "tab_bar_width %u // columns a sidebar takes\n",
c->tab_bar_width);
+ cb_add(&b, "tab_bar_pad %u // blank rows above a sidebar's tabs\n",
+ c->tab_bar_pad);
cb_add(&b, "status_line %s // the line along the bottom\n",
yesno(c->status_line));
cb_add(&b, "status_pad %u\n", c->status_pad);
@@ -1933,6 +1939,7 @@ static const char *const KNOWN_TOP[] = {
"status_bar",
"status_line",
"status_pad",
+ "tab_bar_pad",
"tab_bar_side",
"tab_bar_width",
"theme",
@@ -2145,6 +2152,8 @@ static bool load_into(config_t *c, const char *path, int depth, char *err,
}
c->tab_bar_width = (uint16_t)kdl_arg_int(kdl_child(root, "tab_bar_width"), 0,
c->tab_bar_width);
+ c->tab_bar_pad =
+ (uint16_t)kdl_arg_int(kdl_child(root, "tab_bar_pad"), 0, c->tab_bar_pad);
c->status_line =
kdl_arg_bool(kdl_child(root, "status_line"), 0, c->status_line);
c->status_pad =