From 3fed73d86b3449045bc4b7e8245d6a4c03317bc9 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu, 31 Oct 2024 14:12:32 +0000 Subject: [PATCH] Use fg for slider. --- screen-redraw.c | 26 ++++++++++++-------------- tmux.1 | 8 +++++--- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/screen-redraw.c b/screen-redraw.c index 4f7f9313..2deb22ec 100644 --- a/screen-redraw.c +++ b/screen-redraw.c @@ -1016,19 +1016,21 @@ screen_redraw_draw_scrollbar(struct screen_redraw_ctx *ctx, struct client *c = ctx->c; struct window *w = wp->window; struct tty *tty = &c->tty; - struct grid_cell gc; + struct grid_cell gc, slgc, *gcp; u_int i, j, sb_w = PANE_SCROLLBARS_WIDTH; u_int pad_col = 0; - int fg, bg, px, py, ox = ctx->ox, oy = ctx->oy; + int px, py, ox = ctx->ox, oy = ctx->oy; int sb_pad = PANE_SCROLLBARS_PADDING, sx = ctx->sx; int sy = ctx->sy, xoff = wp->xoff, yoff = wp->yoff; - /* Set up default colour. */ + /* Set up default style. */ style_apply(&gc, w->options, "pane-scrollbars-style", NULL); - fg = gc.fg; - bg = gc.bg; utf8_set(&gc.data, ' '); + /* Set up style for slider. */ + memcpy(&slgc, &gc, sizeof slgc); + slgc.bg = gc.fg; + if (sb_pad != 0) { if (sb_pos == PANE_SCROLLBARS_RIGHT) pad_col = 0; @@ -1048,15 +1050,11 @@ screen_redraw_draw_scrollbar(struct screen_redraw_ctx *ctx, tty_cell(tty, &grid_default_cell, &grid_default_cell, NULL, NULL); } else { - if (j >= slider_y && - j < slider_y + slider_h) { - gc.bg = fg; - gc.fg = bg; - } else { - gc.bg = bg; - gc.fg = fg; - } - tty_cell(tty, &gc, &grid_default_cell, NULL, + if (j >= slider_y && j < slider_y + slider_h) + gcp = &slgc; + else + gcp = &gc; + tty_cell(tty, gcp, &grid_default_cell, NULL, NULL); } } diff --git a/tmux.1 b/tmux.1 index 82efeeb6..2fbb3c99 100644 --- a/tmux.1 +++ b/tmux.1 @@ -5050,15 +5050,17 @@ If set to the pane is narrowed only when the scrollbar is visible. .Pp See also -.Xr pane-scrollbar-style . +.Xr pane-scrollbars-style . .Pp -.It Ic pane-scrollbar-style Ar style -Set the pane scrollbar style for the currently active pane. +.It Ic pane-scrollbars-style Ar style +Set the scrollbars style. For how to specify .Ar style , see the .Sx STYLES section. +The foreground colour is used for the slider, the background for the rest of the +scrollbar. Attributes are ignored. .Pp .It Xo Ic pane-scrollbars-position