mirror of
https://github.com/tmux/tmux.git
synced 2026-06-20 17:25:57 +00:00
Fix various errors in redrawing:
- Fix the active pane colour when only two panes and scrollbars enabled. - Clip left and right scrollbars the same for floating panes. - Do not subtract scrollbar width twice when working out width of status line. - Check if a character is inside a visible range correctly (do not include the next position outside the range).
This commit is contained in:
@@ -211,7 +211,7 @@ screen_redraw_pane_border(struct screen_redraw_ctx *ctx, struct window_pane *wp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Top/bottom borders. */
|
/* Top/bottom borders. */
|
||||||
if (vsplit && pane_status == PANE_STATUS_OFF && sb_w == 0) {
|
if (vsplit && pane_status == PANE_STATUS_OFF) {
|
||||||
if (wp->yoff == 0 && py == sy && px <= sx / 2)
|
if (wp->yoff == 0 && py == sy && px <= sx / 2)
|
||||||
return (SCREEN_REDRAW_BORDER_BOTTOM);
|
return (SCREEN_REDRAW_BORDER_BOTTOM);
|
||||||
if (wp->yoff != 0 && py == wp->yoff - 1 && px > sx / 2)
|
if (wp->yoff != 0 && py == wp->yoff - 1 && px > sx / 2)
|
||||||
@@ -220,9 +220,10 @@ screen_redraw_pane_border(struct screen_redraw_ctx *ctx, struct window_pane *wp,
|
|||||||
if (sb_pos == PANE_SCROLLBARS_LEFT) {
|
if (sb_pos == PANE_SCROLLBARS_LEFT) {
|
||||||
if ((wp->xoff - sb_w == 0 || px >= wp->xoff - sb_w) &&
|
if ((wp->xoff - sb_w == 0 || px >= wp->xoff - sb_w) &&
|
||||||
(px <= ex || (sb_w != 0 && px < ex + sb_w))) {
|
(px <= ex || (sb_w != 0 && px < ex + sb_w))) {
|
||||||
if (wp->yoff != 0 && py == wp->yoff - 1)
|
if (pane_status != PANE_STATUS_BOTTOM &&
|
||||||
|
wp->yoff != 0 && py == wp->yoff - 1)
|
||||||
return (SCREEN_REDRAW_BORDER_TOP);
|
return (SCREEN_REDRAW_BORDER_TOP);
|
||||||
if (py == ey)
|
if (pane_status != PANE_STATUS_TOP && py == ey)
|
||||||
return (SCREEN_REDRAW_BORDER_BOTTOM);
|
return (SCREEN_REDRAW_BORDER_BOTTOM);
|
||||||
}
|
}
|
||||||
} else { /* sb_pos == PANE_SCROLLBARS_RIGHT */
|
} else { /* sb_pos == PANE_SCROLLBARS_RIGHT */
|
||||||
@@ -617,7 +618,7 @@ screen_redraw_make_pane_status(struct client *c, struct window_pane *wp,
|
|||||||
width = 0;
|
width = 0;
|
||||||
else
|
else
|
||||||
width = wp->sx + sb_w - 2;
|
width = wp->sx + sb_w - 2;
|
||||||
max_width = (int)w->sx - (wp->xoff + 2) - sb_w;
|
max_width = (int)w->sx - (wp->xoff + 2);
|
||||||
if (max_width < 0)
|
if (max_width < 0)
|
||||||
max_width = 0;
|
max_width = 0;
|
||||||
if (width > (u_int)max_width)
|
if (width > (u_int)max_width)
|
||||||
@@ -701,7 +702,7 @@ screen_redraw_draw_pane_status(struct screen_redraw_ctx *ctx)
|
|||||||
width = size;
|
width = size;
|
||||||
} else if (xoff < ctx->ox && xoff + size > ctx->ox + ctx->sx) {
|
} else if (xoff < ctx->ox && xoff + size > ctx->ox + ctx->sx) {
|
||||||
/* Both left and right not visible. */
|
/* Both left and right not visible. */
|
||||||
l = ctx->ox;
|
l = ctx->ox - xoff;
|
||||||
x = 0;
|
x = 0;
|
||||||
width = ctx->sx;
|
width = ctx->sx;
|
||||||
} else if (xoff < ctx->ox) {
|
} else if (xoff < ctx->ox) {
|
||||||
@@ -1121,7 +1122,7 @@ screen_redraw_is_visible(struct visible_ranges *r, u_int px)
|
|||||||
return (1);
|
return (1);
|
||||||
for (i = 0; i < r->used; i++) {
|
for (i = 0; i < r->used; i++) {
|
||||||
ri = &r->ranges[i];
|
ri = &r->ranges[i];
|
||||||
if (ri->nx != 0 && px >= ri->px && px <= ri->px + ri->nx)
|
if (ri->nx != 0 && px >= ri->px && px < ri->px + ri->nx)
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
@@ -1143,11 +1144,13 @@ screen_redraw_get_visible_ranges(struct window_pane *base_wp, int px,
|
|||||||
u_int lb, rb, tb, bb;
|
u_int lb, rb, tb, bb;
|
||||||
u_int i, s;
|
u_int i, s;
|
||||||
|
|
||||||
if (px + width <= 0 || py < 0)
|
if (py < 0 || width == 0)
|
||||||
goto empty;
|
goto empty;
|
||||||
if (px < 0) {
|
if (px < 0) {
|
||||||
|
if ((u_int)-px >= width)
|
||||||
|
goto empty;
|
||||||
|
width -= (u_int)-px;
|
||||||
px = 0;
|
px = 0;
|
||||||
width += px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (base_wp == NULL) {
|
if (base_wp == NULL) {
|
||||||
@@ -1194,7 +1197,8 @@ screen_redraw_get_visible_ranges(struct window_pane *base_wp, int px,
|
|||||||
(u_int)py < tb ||
|
(u_int)py < tb ||
|
||||||
(u_int)py > bb)
|
(u_int)py > bb)
|
||||||
continue;
|
continue;
|
||||||
if (!window_pane_is_floating(wp) && (u_int)py == bb)
|
if (!window_pane_is_floating(wp) &&
|
||||||
|
((u_int)py == tb || (u_int)py == bb))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
sb_w = wp->scrollbar_style.width + wp->scrollbar_style.pad;
|
sb_w = wp->scrollbar_style.width + wp->scrollbar_style.pad;
|
||||||
|
|||||||
Reference in New Issue
Block a user