Skip to content

Commit

Permalink
Initialize context before testing it.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicm committed Oct 25, 2022
1 parent 2111142 commit c2580cf
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions screen-write.c
Original file line number Diff line number Diff line change
Expand Up @@ -1505,10 +1505,9 @@ screen_write_fullredraw(struct screen_write_ctx *ctx)

screen_write_collect_flush(ctx, 0, __func__);

if (ttyctx.redraw_cb != NULL) {
screen_write_initctx(ctx, &ttyctx, 1);
screen_write_initctx(ctx, &ttyctx, 1);
if (ttyctx.redraw_cb != NULL)
ttyctx.redraw_cb(&ttyctx);
}
}

/* Trim collected items. */
Expand Down Expand Up @@ -2129,10 +2128,9 @@ screen_write_alternateon(struct screen_write_ctx *ctx, struct grid_cell *gc,
screen_write_collect_flush(ctx, 0, __func__);
screen_alternate_on(ctx->s, gc, cursor);

if (ttyctx.redraw_cb != NULL) {
screen_write_initctx(ctx, &ttyctx, 1);
screen_write_initctx(ctx, &ttyctx, 1);
if (ttyctx.redraw_cb != NULL)
ttyctx.redraw_cb(&ttyctx);
}
}

/* Turn alternate screen off. */
Expand All @@ -2149,8 +2147,7 @@ screen_write_alternateoff(struct screen_write_ctx *ctx, struct grid_cell *gc,
screen_write_collect_flush(ctx, 0, __func__);
screen_alternate_off(ctx->s, gc, cursor);

if (ttyctx.redraw_cb != NULL) {
screen_write_initctx(ctx, &ttyctx, 1);
screen_write_initctx(ctx, &ttyctx, 1);
if (ttyctx.redraw_cb != NULL)
ttyctx.redraw_cb(&ttyctx);
}
}

0 comments on commit c2580cf

Please sign in to comment.