mirror of
https://github.com/tmux/tmux.git
synced 2026-05-30 22:26:18 +00:00
Cache border and active border style separately, fixes problem reported
by Marcel Partap in GitHub issue 5125.
This commit is contained in:
@@ -866,34 +866,40 @@ screen_redraw_pane(struct client *c, struct window_pane *wp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Get border cell style. */
|
/* Get border cell style. */
|
||||||
static const struct grid_cell *
|
static void
|
||||||
screen_redraw_draw_borders_style(struct screen_redraw_ctx *ctx, u_int x,
|
screen_redraw_draw_borders_style(struct screen_redraw_ctx *ctx, u_int x,
|
||||||
u_int y, struct window_pane *wp)
|
u_int y, struct window_pane *wp, struct grid_cell *ngc)
|
||||||
{
|
{
|
||||||
struct client *c = ctx->c;
|
struct client *c = ctx->c;
|
||||||
struct session *s = c->session;
|
struct session *s = c->session;
|
||||||
struct window *w = s->curw->window;
|
struct window *w = s->curw->window;
|
||||||
struct window_pane *active = server_client_get_pane(c);
|
struct window_pane *active = server_client_get_pane(c);
|
||||||
struct options *wo = w->options;
|
struct grid_cell *gc;
|
||||||
const char *border_option;
|
const char *border_option;
|
||||||
struct format_tree *ft;
|
struct format_tree *ft;
|
||||||
|
int *flag;
|
||||||
|
|
||||||
if (wp->border_gc_set)
|
if (screen_redraw_check_is(ctx, x, y, active)) {
|
||||||
return (&wp->border_gc);
|
flag = &wp->active_border_gc_set;
|
||||||
wp->border_gc_set = 1;
|
gc = &wp->active_border_gc;
|
||||||
|
|
||||||
ft = format_create_defaults(NULL, c, s, s->curw, wp);
|
|
||||||
|
|
||||||
if (screen_redraw_check_is(ctx, x, y, active))
|
|
||||||
border_option = "pane-active-border-style";
|
border_option = "pane-active-border-style";
|
||||||
else
|
} else {
|
||||||
|
flag = &wp->border_gc_set;
|
||||||
|
gc = &wp->border_gc;
|
||||||
border_option = "pane-border-style";
|
border_option = "pane-border-style";
|
||||||
style_apply(&wp->border_gc, wo, border_option, ft);
|
}
|
||||||
if (options_get_only(wp->options, border_option) != NULL)
|
|
||||||
style_add(&wp->border_gc, wp->options, border_option, ft);
|
|
||||||
|
|
||||||
format_free(ft);
|
if (!*flag) {
|
||||||
return (&wp->border_gc);
|
ft = format_create_defaults(NULL, c, s, s->curw, wp);
|
||||||
|
|
||||||
|
style_apply(gc, w->options, border_option, ft);
|
||||||
|
if (options_get_only(wp->options, border_option) != NULL)
|
||||||
|
style_add(gc, wp->options, border_option, ft);
|
||||||
|
|
||||||
|
format_free(ft);
|
||||||
|
*flag = 1;
|
||||||
|
}
|
||||||
|
memcpy(ngc, gc, sizeof *ngc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Draw arrow indicator if enabled. */
|
/* Draw arrow indicator if enabled. */
|
||||||
@@ -981,7 +987,6 @@ screen_redraw_draw_borders_cell(struct screen_redraw_ctx *ctx, u_int i, u_int j)
|
|||||||
struct format_tree *ft;
|
struct format_tree *ft;
|
||||||
struct window_pane *wp, *active = server_client_get_pane(c);
|
struct window_pane *wp, *active = server_client_get_pane(c);
|
||||||
struct grid_cell gc;
|
struct grid_cell gc;
|
||||||
const struct grid_cell *tmp;
|
|
||||||
u_int cell_type;
|
u_int cell_type;
|
||||||
u_int x = ctx->ox + i, y = ctx->oy + j;
|
u_int x = ctx->ox + i, y = ctx->oy + j;
|
||||||
int isolates;
|
int isolates;
|
||||||
@@ -1008,11 +1013,7 @@ screen_redraw_draw_borders_cell(struct screen_redraw_ctx *ctx, u_int i, u_int j)
|
|||||||
}
|
}
|
||||||
memcpy(&gc, &ctx->no_pane_gc, sizeof gc);
|
memcpy(&gc, &ctx->no_pane_gc, sizeof gc);
|
||||||
} else {
|
} else {
|
||||||
tmp = screen_redraw_draw_borders_style(ctx, x, y, wp);
|
screen_redraw_draw_borders_style(ctx, x, y, wp, &gc);
|
||||||
if (tmp == NULL)
|
|
||||||
return;
|
|
||||||
memcpy(&gc, tmp, sizeof gc);
|
|
||||||
|
|
||||||
if (server_is_marked(s, s->curw, marked_pane.wp) &&
|
if (server_is_marked(s, s->curw, marked_pane.wp) &&
|
||||||
screen_redraw_check_is(ctx, x, y, marked_pane.wp))
|
screen_redraw_check_is(ctx, x, y, marked_pane.wp))
|
||||||
gc.attr ^= GRID_ATTR_REVERSE;
|
gc.attr ^= GRID_ATTR_REVERSE;
|
||||||
@@ -1052,8 +1053,10 @@ screen_redraw_draw_borders(struct screen_redraw_ctx *ctx)
|
|||||||
|
|
||||||
log_debug("%s: %s @%u", __func__, c->name, w->id);
|
log_debug("%s: %s @%u", __func__, c->name, w->id);
|
||||||
|
|
||||||
TAILQ_FOREACH(wp, &w->panes, entry)
|
TAILQ_FOREACH(wp, &w->panes, entry) {
|
||||||
wp->border_gc_set = 0;
|
wp->border_gc_set = 0;
|
||||||
|
wp->active_border_gc_set = 0;
|
||||||
|
}
|
||||||
|
|
||||||
for (j = 0; j < c->tty.sy - ctx->statuslines; j++) {
|
for (j = 0; j < c->tty.sy - ctx->statuslines; j++) {
|
||||||
for (i = 0; i < c->tty.sx; i++)
|
for (i = 0; i < c->tty.sx; i++)
|
||||||
@@ -1318,7 +1321,7 @@ screen_redraw_draw_pane(struct screen_redraw_ctx *ctx, struct window_pane *wp)
|
|||||||
if (wp->yoff + (int)j < (int)ctx->oy ||
|
if (wp->yoff + (int)j < (int)ctx->oy ||
|
||||||
wp->yoff + (int)j >= (int)ctx->oy + (int)ctx->sy)
|
wp->yoff + (int)j >= (int)ctx->oy + (int)ctx->sy)
|
||||||
continue;
|
continue;
|
||||||
wy = wp->yoff + j; /* y line within window w */
|
wy = wp->yoff + j; /* y line within window w */
|
||||||
py = woy + wy - ctx->oy; /* y line within tty */
|
py = woy + wy - ctx->oy; /* y line within tty */
|
||||||
if (py > tty->sy) {
|
if (py > tty->sy) {
|
||||||
/* Continue if this line is off of tty. */
|
/* Continue if this line is off of tty. */
|
||||||
@@ -1391,7 +1394,7 @@ screen_redraw_draw_pane_scrollbar(struct screen_redraw_ctx *ctx,
|
|||||||
int sb_w = wp->scrollbar_style.width;
|
int sb_w = wp->scrollbar_style.width;
|
||||||
int sb_pad = wp->scrollbar_style.pad;
|
int sb_pad = wp->scrollbar_style.pad;
|
||||||
int cm_y, cm_size, xoff = wp->xoff;
|
int cm_y, cm_size, xoff = wp->xoff;
|
||||||
int sb_x, sb_y = (int)(wp->yoff); /* sb top */
|
int sb_x, sb_y = (int)wp->yoff; /* 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)
|
||||||
|
|||||||
Reference in New Issue
Block a user