summaryrefslogtreecommitdiffstats
path: root/screen-write.c
diff options
context:
space:
mode:
authornicm <nicm>2022-10-25 17:53:31 +0000
committernicm <nicm>2022-10-25 17:53:31 +0000
commitc2580cfe2466589c8bd9348225820888a3fc4c0a (patch)
treebb3b0ee91eaaea3cc2fd43a831701d8ec580de40 /screen-write.c
parent2111142cf1715eeac174cd5c71ed90f00595b17e (diff)
Initialize context before testing it.
Diffstat (limited to 'screen-write.c')
-rw-r--r--screen-write.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/screen-write.c b/screen-write.c
index a2107f2a..24195708 100644
--- a/screen-write.c
+++ b/screen-write.c
@@ -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. */
@@ -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. */
@@ -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);
- }
}