From 924a158ae16809f41bf3f03c54fb2a8cdfa1d6e8 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 25 Oct 2022 17:53:31 +0000 Subject: [PATCH] Initialize context before testing it. --- usr.bin/tmux/screen-write.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/usr.bin/tmux/screen-write.c b/usr.bin/tmux/screen-write.c index 3880577806a..3e8eeafd16e 100644 --- a/usr.bin/tmux/screen-write.c +++ b/usr.bin/tmux/screen-write.c @@ -1,4 +1,4 @@ -/* $OpenBSD: screen-write.c,v 1.210 2022/10/25 09:04:49 nicm Exp $ */ +/* $OpenBSD: screen-write.c,v 1.211 2022/10/25 17:53:31 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -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); - } } -- 2.20.1