mirror of
https://github.com/tmux/tmux.git
synced 2025-09-01 20:57:00 +00:00
Merge branch 'obsd-master'
This commit is contained in:
@ -138,7 +138,7 @@ screen_redraw_pane_border(struct screen_redraw_ctx *ctx, struct window_pane *wp,
|
||||
|
||||
/* Are scrollbars enabled? */
|
||||
if (window_pane_show_scrollbar(wp, pane_scrollbars))
|
||||
sb_w = PANE_SCROLLBARS_WIDTH;
|
||||
sb_w = wp->scrollbar_style.width + wp->scrollbar_style.pad;
|
||||
|
||||
/*
|
||||
* Left/right borders. The wp->sy / 2 test is to colour only half the
|
||||
@ -171,7 +171,7 @@ screen_redraw_pane_border(struct screen_redraw_ctx *ctx, struct window_pane *wp,
|
||||
} else {
|
||||
if (sb_pos == PANE_SCROLLBARS_LEFT) {
|
||||
if ((wp->xoff - sb_w == 0 || px >= wp->xoff - sb_w) &&
|
||||
(px <= ex || (sb_w != 0 && px - 1 == ex))) {
|
||||
(px <= ex || (sb_w != 0 && px < ex + sb_w))) {
|
||||
if (wp->yoff != 0 && py == wp->yoff - 1)
|
||||
return (SCREEN_REDRAW_BORDER_TOP);
|
||||
if (py == ey)
|
||||
@ -179,7 +179,7 @@ screen_redraw_pane_border(struct screen_redraw_ctx *ctx, struct window_pane *wp,
|
||||
}
|
||||
} else { /* sb_pos == PANE_SCROLLBARS_RIGHT */
|
||||
if ((wp->xoff == 0 || px >= wp->xoff) &&
|
||||
(px <= ex || (sb_w != 0 && px - 1 == ex))) {
|
||||
(px <= ex || (sb_w != 0 && px < ex + sb_w))) {
|
||||
if (wp->yoff != 0 && py == wp->yoff - 1)
|
||||
return (SCREEN_REDRAW_BORDER_TOP);
|
||||
if (py == ey)
|
||||
@ -324,7 +324,7 @@ screen_redraw_check_cell(struct screen_redraw_ctx *ctx, u_int px, u_int py,
|
||||
int border, pane_scrollbars = ctx->pane_scrollbars;
|
||||
u_int right, line;
|
||||
int sb_pos = ctx->pane_scrollbars_pos;
|
||||
int sb_w = PANE_SCROLLBARS_WIDTH;
|
||||
int sb_w;
|
||||
|
||||
*wpp = NULL;
|
||||
|
||||
@ -374,6 +374,8 @@ screen_redraw_check_cell(struct screen_redraw_ctx *ctx, u_int px, u_int py,
|
||||
* pane is at the top then py == 0 to sy; if the pane
|
||||
* is not at the top, then yoff to yoff + sy.
|
||||
*/
|
||||
sb_w = wp->scrollbar_style.width +
|
||||
wp->scrollbar_style.pad;
|
||||
if ((pane_status && py != line) ||
|
||||
(wp->yoff == 0 && py < wp->sy) ||
|
||||
(py >= wp->yoff && py < wp->yoff + wp->sy)) {
|
||||
@ -948,7 +950,9 @@ screen_redraw_draw_pane_scrollbar(struct screen_redraw_ctx *ctx,
|
||||
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;
|
||||
int sb_w = wp->scrollbar_style.width;
|
||||
int sb_pad = wp->scrollbar_style.pad;
|
||||
int cm_y, cm_size, xoff = wp->xoff, ox = ctx->ox;
|
||||
int sb_x, sb_y = (int)(wp->yoff - ctx->oy); /* sb top */
|
||||
|
||||
if (window_pane_mode(wp) == WINDOW_PANE_NO_MODE) {
|
||||
@ -971,9 +975,9 @@ screen_redraw_draw_pane_scrollbar(struct screen_redraw_ctx *ctx,
|
||||
}
|
||||
|
||||
if (sb_pos == PANE_SCROLLBARS_LEFT)
|
||||
sb_x = (int)wp->xoff - sb_w - ctx->ox;
|
||||
sb_x = xoff - sb_w - sb_pad - ox;
|
||||
else
|
||||
sb_x = (int)wp->xoff + wp->sx - ctx->ox;
|
||||
sb_x = xoff + wp->sx - ox;
|
||||
|
||||
if (slider_h < 1)
|
||||
slider_h = 1;
|
||||
@ -994,39 +998,42 @@ screen_redraw_draw_scrollbar(struct screen_redraw_ctx *ctx,
|
||||
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, slgc, *gcp;
|
||||
u_int i, j, sb_w = PANE_SCROLLBARS_WIDTH;
|
||||
u_int pad_col = 0;
|
||||
struct style *sb_style = &wp->scrollbar_style;
|
||||
u_int i, j, imax, jmax;
|
||||
u_int sb_w = sb_style->width, sb_pad = sb_style->pad;
|
||||
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 style. */
|
||||
style_apply(&gc, w->options, "pane-scrollbars-style", NULL);
|
||||
utf8_set(&gc.data, ' ');
|
||||
int sx = ctx->sx, sy = ctx->sy, xoff = wp->xoff;
|
||||
int yoff = wp->yoff;
|
||||
|
||||
/* Set up style for slider. */
|
||||
gc = sb_style->gc;
|
||||
memcpy(&slgc, &gc, sizeof slgc);
|
||||
slgc.fg = gc.bg;
|
||||
slgc.bg = gc.fg;
|
||||
|
||||
if (sb_pad != 0) {
|
||||
if (sb_pos == PANE_SCROLLBARS_RIGHT)
|
||||
pad_col = 0;
|
||||
else
|
||||
pad_col = sb_w - 1;
|
||||
}
|
||||
imax = sb_w + sb_pad;
|
||||
if ((int)imax + sb_x > sx)
|
||||
imax = sx - sb_x;
|
||||
jmax = sb_h;
|
||||
if ((int)jmax + sb_y > sy)
|
||||
jmax = sy - sb_y;
|
||||
|
||||
for (i = 0; i < sb_w; i++) {
|
||||
for (j = 0; j < sb_h; j++) {
|
||||
for (j = 0; j < jmax; j++) {
|
||||
py = sb_y + j;
|
||||
for (i = 0; i < imax; i++) {
|
||||
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)
|
||||
if (px < xoff - ox - (int)sb_w - (int)sb_pad ||
|
||||
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_pos == PANE_SCROLLBARS_LEFT &&
|
||||
i >= sb_w && i < sb_w + sb_pad) ||
|
||||
(sb_pos == PANE_SCROLLBARS_RIGHT &&
|
||||
i < sb_pad)) {
|
||||
tty_cell(tty, &grid_default_cell,
|
||||
&grid_default_cell, NULL, NULL);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user