mirror of
https://github.com/tmux/tmux.git
synced 2025-01-09 01:28:49 +00:00
Fix scrollbars with large window sizes.
This commit is contained in:
parent
3c6c7f3422
commit
561441fa54
@ -31,9 +31,8 @@ static void screen_redraw_draw_pane(struct screen_redraw_ctx *,
|
||||
static void screen_redraw_set_context(struct client *,
|
||||
struct screen_redraw_ctx *);
|
||||
static void screen_redraw_draw_pane_scrollbars(struct screen_redraw_ctx *);
|
||||
static void screen_redraw_draw_scrollbar(struct client *,
|
||||
struct window_pane *, int, u_int, u_int, u_int, u_int,
|
||||
u_int);
|
||||
static void screen_redraw_draw_scrollbar(struct screen_redraw_ctx *,
|
||||
struct window_pane *, int, int, int, u_int, u_int, u_int);
|
||||
static void screen_redraw_draw_pane_scrollbar(struct screen_redraw_ctx *,
|
||||
struct window_pane *);
|
||||
|
||||
@ -969,13 +968,12 @@ void
|
||||
screen_redraw_draw_pane_scrollbar(struct screen_redraw_ctx *ctx,
|
||||
struct window_pane *wp)
|
||||
{
|
||||
struct client *c = ctx->c;
|
||||
struct screen *s = wp->screen;
|
||||
double percent_view;
|
||||
u_int sb = ctx->pane_scrollbars, total_height, sb_h = wp->sy;
|
||||
u_int sb_pos = ctx->pane_scrollbars_pos, slider_h, slider_y;
|
||||
u_int sb_w = PANE_SCROLLBARS_WIDTH, cm_y, cm_size;
|
||||
u_int sb_x, sb_y = wp->yoff; /* upper left of scrollbar */
|
||||
int sb_x, sb_y = (int)(wp->yoff - ctx->oy); /* sb top */
|
||||
|
||||
if (window_pane_mode(wp) == WINDOW_PANE_NO_MODE) {
|
||||
if (sb == PANE_SCROLLBARS_MODAL)
|
||||
@ -997,30 +995,33 @@ screen_redraw_draw_pane_scrollbar(struct screen_redraw_ctx *ctx,
|
||||
}
|
||||
|
||||
if (sb_pos == PANE_SCROLLBARS_LEFT)
|
||||
sb_x = wp->xoff - sb_w;
|
||||
sb_x = (int)wp->xoff - sb_w - ctx->ox;
|
||||
else
|
||||
sb_x = wp->xoff + wp->sx;
|
||||
sb_x = (int)wp->xoff + wp->sx - ctx->ox;
|
||||
|
||||
if (slider_h < 1)
|
||||
slider_h = 1;
|
||||
if (slider_y >= sb_h)
|
||||
slider_y = sb_h - 1;
|
||||
|
||||
screen_redraw_draw_scrollbar(c, wp, sb_pos, sb_x, sb_y, sb_h, slider_h,
|
||||
slider_y);
|
||||
screen_redraw_draw_scrollbar(ctx, wp, sb_pos, sb_x, sb_y, sb_h,
|
||||
slider_h, slider_y);
|
||||
}
|
||||
|
||||
static void
|
||||
screen_redraw_draw_scrollbar(struct client *c, struct window_pane *wp,
|
||||
int sb_pos, u_int px, u_int py, u_int sb_h, u_int slider_h, u_int slider_y)
|
||||
screen_redraw_draw_scrollbar(struct screen_redraw_ctx *ctx,
|
||||
struct window_pane *wp, int sb_pos, int sb_x, int sb_y, u_int sb_h,
|
||||
u_int slider_h, u_int slider_y)
|
||||
{
|
||||
struct client *c = ctx->c;
|
||||
struct window *w = wp->window;
|
||||
struct tty *tty = &c->tty;
|
||||
struct grid_cell gc;
|
||||
int fg, bg;
|
||||
u_int i, j, pad_col = 0;
|
||||
u_int sb_w = PANE_SCROLLBARS_WIDTH;
|
||||
u_int sb_pad = PANE_SCROLLBARS_PADDING;
|
||||
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 sb_pad = PANE_SCROLLBARS_PADDING, sx = ctx->sx;
|
||||
int sy = ctx->sy, xoff = wp->xoff, yoff = wp->yoff;
|
||||
|
||||
/* Set up default colour. */
|
||||
style_apply(&gc, w->options, "pane-scrollbars-style", NULL);
|
||||
@ -1037,12 +1038,18 @@ screen_redraw_draw_scrollbar(struct client *c, struct window_pane *wp,
|
||||
|
||||
for (i = 0; i < sb_w; i++) {
|
||||
for (j = 0; j < sb_h; j++) {
|
||||
tty_cursor(tty, px + i, py + j);
|
||||
px = sb_x + i;
|
||||
py = sb_y + j;
|
||||
if (px < xoff - ox - 1 || px >= sx || px < 0 ||
|
||||
py < yoff - oy - 1 || py >= sy || py < 0)
|
||||
continue;
|
||||
tty_cursor(tty, px, py);
|
||||
if (sb_pad && i == pad_col) {
|
||||
tty_cell(tty, &grid_default_cell,
|
||||
&grid_default_cell, NULL, NULL);
|
||||
} else {
|
||||
if (j >= slider_y && j < slider_y + slider_h) {
|
||||
if (j >= slider_y &&
|
||||
j < slider_y + slider_h) {
|
||||
gc.bg = fg;
|
||||
gc.fg = bg;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user