Do not hoke into struct window_pane from the tty code and instead set

everything up in tty_ctx. Provide a way to initialize the tty_ctx from a
callback and use it to let popups draw directly through input_parse in
the same way as panes do, rather than forcing a full redraw on every
change.
This commit is contained in:
nicm
2020-05-16 15:34:08 +00:00
parent 379ca54c80
commit 9605b080f6
16 changed files with 468 additions and 356 deletions

View File

@ -346,7 +346,7 @@ screen_redraw_make_pane_status(struct client *c, struct window *w,
screen_init(&wp->status_screen, width, 1, 0);
wp->status_screen.mode = 0;
screen_write_start(&ctx, NULL, &wp->status_screen);
screen_write_start(&ctx, &wp->status_screen);
gc.attr |= GRID_ATTR_CHARSET;
for (i = 0; i < width; i++)
@ -423,7 +423,8 @@ screen_redraw_draw_pane_status(struct screen_redraw_ctx *ctx)
if (ctx->statustop)
yoff += ctx->statuslines;
tty_draw_line(tty, NULL, s, i, 0, width, x, yoff - ctx->oy);
tty_draw_line(tty, s, i, 0, width, x, yoff - ctx->oy,
&grid_default_cell, NULL);
}
tty_cursor(tty, 0, 0);
}
@ -615,7 +616,7 @@ screen_redraw_draw_borders_cell(struct screen_redraw_ctx *ctx, u_int i, u_int j)
}
}
tty_attributes(tty, gc, NULL);
tty_attributes(tty, gc, &grid_default_cell, NULL);
if (ctx->statustop)
tty_cursor(tty, i, ctx->statuslines + j);
else
@ -676,8 +677,10 @@ screen_redraw_draw_status(struct screen_redraw_ctx *ctx)
y = 0;
else
y = c->tty.sy - ctx->statuslines;
for (i = 0; i < ctx->statuslines; i++)
tty_draw_line(tty, NULL, s, 0, i, UINT_MAX, 0, y + i);
for (i = 0; i < ctx->statuslines; i++) {
tty_draw_line(tty, s, 0, i, UINT_MAX, 0, y + i,
&grid_default_cell, NULL);
}
}
/* Draw one pane. */
@ -688,6 +691,7 @@ screen_redraw_draw_pane(struct screen_redraw_ctx *ctx, struct window_pane *wp)
struct window *w = c->session->curw->window;
struct tty *tty = &c->tty;
struct screen *s;
struct grid_cell defaults;
u_int i, j, top, x, y, width;
log_debug("%s: %s @%u %%%u", __func__, c->name, w->id, wp->id);
@ -731,6 +735,8 @@ screen_redraw_draw_pane(struct screen_redraw_ctx *ctx, struct window_pane *wp)
log_debug("%s: %s %%%u line %u,%u at %u,%u, width %u",
__func__, c->name, wp->id, i, j, x, y, width);
tty_draw_line(tty, wp, s, i, j, width, x, y);
tty_default_colours(&defaults, wp);
tty_draw_line(tty, s, i, j, width, x, y, &defaults,
wp->palette);
}
}