mirror of
https://github.com/tmux/tmux.git
synced 2025-01-10 01:58:51 +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 *,
|
static void screen_redraw_set_context(struct client *,
|
||||||
struct screen_redraw_ctx *);
|
struct screen_redraw_ctx *);
|
||||||
static void screen_redraw_draw_pane_scrollbars(struct screen_redraw_ctx *);
|
static void screen_redraw_draw_pane_scrollbars(struct screen_redraw_ctx *);
|
||||||
static void screen_redraw_draw_scrollbar(struct client *,
|
static void screen_redraw_draw_scrollbar(struct screen_redraw_ctx *,
|
||||||
struct window_pane *, int, u_int, u_int, u_int, u_int,
|
struct window_pane *, int, int, int, u_int, u_int, u_int);
|
||||||
u_int);
|
|
||||||
static void screen_redraw_draw_pane_scrollbar(struct screen_redraw_ctx *,
|
static void screen_redraw_draw_pane_scrollbar(struct screen_redraw_ctx *,
|
||||||
struct window_pane *);
|
struct window_pane *);
|
||||||
|
|
||||||
@ -969,13 +968,12 @@ void
|
|||||||
screen_redraw_draw_pane_scrollbar(struct screen_redraw_ctx *ctx,
|
screen_redraw_draw_pane_scrollbar(struct screen_redraw_ctx *ctx,
|
||||||
struct window_pane *wp)
|
struct window_pane *wp)
|
||||||
{
|
{
|
||||||
struct client *c = ctx->c;
|
|
||||||
struct screen *s = wp->screen;
|
struct screen *s = wp->screen;
|
||||||
double percent_view;
|
double percent_view;
|
||||||
u_int sb = ctx->pane_scrollbars, total_height, sb_h = wp->sy;
|
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_pos = ctx->pane_scrollbars_pos, slider_h, slider_y;
|
||||||
u_int sb_w = PANE_SCROLLBARS_WIDTH, cm_y, cm_size;
|
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 (window_pane_mode(wp) == WINDOW_PANE_NO_MODE) {
|
||||||
if (sb == PANE_SCROLLBARS_MODAL)
|
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)
|
if (sb_pos == PANE_SCROLLBARS_LEFT)
|
||||||
sb_x = wp->xoff - sb_w;
|
sb_x = (int)wp->xoff - sb_w - ctx->ox;
|
||||||
else
|
else
|
||||||
sb_x = wp->xoff + wp->sx;
|
sb_x = (int)wp->xoff + wp->sx - ctx->ox;
|
||||||
|
|
||||||
if (slider_h < 1)
|
if (slider_h < 1)
|
||||||
slider_h = 1;
|
slider_h = 1;
|
||||||
if (slider_y >= sb_h)
|
if (slider_y >= sb_h)
|
||||||
slider_y = sb_h - 1;
|
slider_y = sb_h - 1;
|
||||||
|
|
||||||
screen_redraw_draw_scrollbar(c, wp, sb_pos, sb_x, sb_y, sb_h, slider_h,
|
screen_redraw_draw_scrollbar(ctx, wp, sb_pos, sb_x, sb_y, sb_h,
|
||||||
slider_y);
|
slider_h, slider_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
screen_redraw_draw_scrollbar(struct client *c, struct window_pane *wp,
|
screen_redraw_draw_scrollbar(struct screen_redraw_ctx *ctx,
|
||||||
int sb_pos, u_int px, u_int py, u_int sb_h, u_int slider_h, u_int slider_y)
|
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 window *w = wp->window;
|
||||||
struct tty *tty = &c->tty;
|
struct tty *tty = &c->tty;
|
||||||
struct grid_cell gc;
|
struct grid_cell gc;
|
||||||
int fg, bg;
|
u_int i, j, sb_w = PANE_SCROLLBARS_WIDTH;
|
||||||
u_int i, j, pad_col = 0;
|
u_int pad_col = 0;
|
||||||
u_int sb_w = PANE_SCROLLBARS_WIDTH;
|
int fg, bg, px, py, ox = ctx->ox, oy = ctx->oy;
|
||||||
u_int sb_pad = PANE_SCROLLBARS_PADDING;
|
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 colour. */
|
||||||
style_apply(&gc, w->options, "pane-scrollbars-style", NULL);
|
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 (i = 0; i < sb_w; i++) {
|
||||||
for (j = 0; j < sb_h; j++) {
|
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) {
|
if (sb_pad && i == pad_col) {
|
||||||
tty_cell(tty, &grid_default_cell,
|
tty_cell(tty, &grid_default_cell,
|
||||||
&grid_default_cell, NULL, NULL);
|
&grid_default_cell, NULL, NULL);
|
||||||
} else {
|
} else {
|
||||||
if (j >= slider_y && j < slider_y + slider_h) {
|
if (j >= slider_y &&
|
||||||
|
j < slider_y + slider_h) {
|
||||||
gc.bg = fg;
|
gc.bg = fg;
|
||||||
gc.fg = bg;
|
gc.fg = bg;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user