diff options
| author | Peter Geissler <peter@haxx.in> | 2026-09-20 20:23:23 +0200 |
|---|---|---|
| committer | Peter Geissler <peter@haxx.in> | 2026-09-20 20:23:23 +0200 |
| commit | 07e1adf1124657aaea4fa32874282812281e4889 (patch) | |
| tree | ab63600e4438260e3e5c650bc711645fe21d066a /src/app_draw.c | |
| parent | sidebar: a status can have more than one row (tab_bar_status_lines) (diff) | |
| download | slosh-07e1adf1124657aaea4fa32874282812281e4889.tar.gz slosh-07e1adf1124657aaea4fa32874282812281e4889.tar.xz slosh-07e1adf1124657aaea4fa32874282812281e4889.zip | |
sidebar: air between tabs (tab_gap)
A tab carrying three rows of wrapped status and the tab under it carrying
three more read as one column of text: the labels are in there, but the list
has stopped looking like a list. tab_gap is the blank rows between them, 0 by
default, which is exactly what the sidebar has always drawn.
It is the space *between* tabs and nothing else. Above the first tab is
tab_bar_pad's and before the button is newtab_pad's, so the gap is applied
before each label except the first and none of the three is ever paid twice.
Given up a row at a time when the list is short of room, ahead of every label
and the button, which is the same order the pad and the statuses already
follow: a gap that pushed a tab off the bottom would be spacing costing you
the thing it spaces. Paint rather than layout, so tuning it repaints without
reflowing any pane. Sidebars only -- the top strip is one row, and the space
between tabs there is the label's own padding.
Diffstat (limited to 'src/app_draw.c')
| -rw-r--r-- | src/app_draw.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/app_draw.c b/src/app_draw.c index 863b7f0..a363143 100644 --- a/src/app_draw.c +++ b/src/app_draw.c @@ -2188,6 +2188,23 @@ void draw_tab_sidebar(app_t *a, screen_t *s) { uint16_t btn_rows = (CFG.newtab_button && cells(CFG.newtab_mark)) ? (uint16_t)1 : (uint16_t)0; for (size_t i = 0; i < a->ntabs && y < limit; i++) { + /* Air between one tab and the next. Before the label rather than after + * the statuses, so it is the gap between two tabs and not a trailing + * margin under the last one -- the space before the first is + * tab_bar_pad's and the space before the button is newtab_pad's, and + * neither should be paid twice. + * + * Given up a row at a time when the list is short of room, ahead of + * anything that means something: a gap that pushed a tab off the bottom + * would be spacing costing you the thing it spaces. */ + if (i) { + uint16_t g = CFG.tab_gap; + /* This tab's own label, the ones after it, and the button. */ + uint16_t need = (uint16_t)(a->ntabs - i + btn_rows); + while (g && (uint16_t)(y + g + need) > limit) g--; + y = (uint16_t)(y + g); + if (y >= limit) break; + } draw_tab_cell(a, s, i, cx, y, cw, dragging_pane); y++; if (!cap) continue; |
