Fix scrollbar pad to work even if not set in style.

This commit is contained in:
nicm
2026-06-22 13:57:33 +00:00
parent d8370864f3
commit 02b37b3c69
2 changed files with 18 additions and 14 deletions

View File

@@ -441,7 +441,7 @@ layout_fix_panes(struct window *w, struct window_pane *skip)
if (sb_pad < 0)
sb_pad = 0;
if (sb_pos == PANE_SCROLLBARS_LEFT) {
if ((int)sx - sb_w < PANE_MINIMUM) {
if ((int)sx - sb_w - sb_pad < PANE_MINIMUM) {
wp->xoff = wp->xoff +
(int)sx - PANE_MINIMUM;
sx = PANE_MINIMUM;

30
style.c
View File

@@ -454,22 +454,26 @@ void
style_set_scrollbar_style_from_option(struct style *sb_style,
struct options *oo)
{
struct style *sy;
const struct options_table_entry *oe;
struct options_entry *o;
const char *s;
sy = options_string_to_style(oo, "pane-scrollbars-style", NULL);
if (sy == NULL) {
style_set(sb_style, &grid_default_cell);
style_set(sb_style, &grid_default_cell);
o = options_get(oo, "pane-scrollbars-style");
if (o == NULL)
fatalx("missing pane-scrollbars-style");
oe = options_table_entry(o);
if (style_parse(sb_style, &grid_default_cell, oe->default_str) != 0)
fatalx("bad pane-scrollbars-style default");
s = options_get_string(oo, "pane-scrollbars-style");
if (s != NULL && style_parse(sb_style, &grid_default_cell, s) != 0)
style_parse(sb_style, &grid_default_cell, oe->default_str);
if (sb_style->width < 1)
sb_style->width = PANE_SCROLLBARS_DEFAULT_WIDTH;
if (sb_style->pad < 0)
sb_style->pad = PANE_SCROLLBARS_DEFAULT_PADDING;
utf8_set(&sb_style->gc.data, PANE_SCROLLBARS_CHARACTER);
} else {
style_copy(sb_style, sy);
if (sb_style->width < 1)
sb_style->width = PANE_SCROLLBARS_DEFAULT_WIDTH;
if (sb_style->pad < 0)
sb_style->pad = PANE_SCROLLBARS_DEFAULT_PADDING;
utf8_set(&sb_style->gc.data, PANE_SCROLLBARS_CHARACTER);
}
utf8_set(&sb_style->gc.data, PANE_SCROLLBARS_CHARACTER);
}
/* Initialize style ranges. */