Final bits of redraw.

This commit is contained in:
Nicholas Marriott
2026-06-16 21:42:35 +01:00
parent 37f36a28b3
commit 6c417be840
6 changed files with 144 additions and 91 deletions

View File

@@ -48,6 +48,16 @@ struct cmd_display_panes_data {
struct args_command_state *state;
};
struct cmd_display_panes_ctx {
struct client *c;
int ox;
int oy;
u_int sx;
u_int sy;
u_int statuslines;
int statustop;
};
static enum args_parse_type
cmd_display_panes_args_parse(__unused struct args *args, __unused u_int idx,
__unused char **cause)
@@ -56,7 +66,7 @@ cmd_display_panes_args_parse(__unused struct args *args, __unused u_int idx,
}
static void
cmd_display_panes_put(struct screen_redraw_ctx *ctx,
cmd_display_panes_put(struct cmd_display_panes_ctx *ctx,
struct window_pane *wp, u_int cx, u_int cy, const char *buf, size_t len)
{
struct client *c = ctx->c;
@@ -76,7 +86,7 @@ cmd_display_panes_put(struct screen_redraw_ctx *ctx,
}
static void
cmd_display_panes_draw_format(struct screen_redraw_ctx *ctx,
cmd_display_panes_draw_format(struct cmd_display_panes_ctx *ctx,
struct window_pane *wp, u_int xoff, u_int yoff, u_int sx,
const struct grid_cell *gc)
{
@@ -112,7 +122,7 @@ cmd_display_panes_draw_format(struct screen_redraw_ctx *ctx,
}
static void
cmd_display_panes_draw_pane(struct screen_redraw_ctx *ctx,
cmd_display_panes_draw_pane(struct cmd_display_panes_ctx *ctx,
struct window_pane *wp)
{
struct client *c = ctx->c;
@@ -254,17 +264,26 @@ out:
}
static void
cmd_display_panes_draw(struct client *c, __unused void *data,
struct screen_redraw_ctx *ctx)
cmd_display_panes_draw(struct client *c, __unused void *data)
{
struct window *w = c->session->curw->window;
struct window_pane *wp;
struct session *s = c->session;
struct window *w = s->curw->window;
struct window_pane *wp;
struct cmd_display_panes_ctx ctx;
log_debug("%s: %s @%u", __func__, c->name, w->id);
memset(&ctx, 0, sizeof ctx);
ctx.c = c;
tty_window_offset(&c->tty, &ctx.ox, &ctx.oy, &ctx.sx, &ctx.sy);
if (options_get_number(s->options, "status-position") == 0) {
ctx.statuslines = status_line_size(c);
ctx.statustop = 1;
}
TAILQ_FOREACH(wp, &w->panes, entry) {
if (window_pane_is_visible(wp))
cmd_display_panes_draw_pane(ctx, wp);
cmd_display_panes_draw_pane(&ctx, wp);
}
}