From 09a66451ce3df94120bb7d8486c89158bc5b85c6 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 14 May 2020 13:18:05 +0100 Subject: [PATCH] Add screen write flags instead of individual bits and fix line length calculation with padding. --- grid.c | 4 +++- screen-write.c | 4 ++-- tmux.h | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/grid.c b/grid.c index 2437e2ea..06a82522 100644 --- a/grid.c +++ b/grid.c @@ -1391,7 +1391,9 @@ grid_line_length(struct grid *gd, u_int py) px = gd->sx; while (px > 0) { grid_get_cell(gd, px - 1, py, &gc); - if (gc.data.size != 1 || *gc.data.data != ' ') + if ((gc.flags & GRID_FLAG_PADDING) || + gc.data.size != 1 || + *gc.data.data != ' ') break; px--; } diff --git a/screen-write.c b/screen-write.c index 9571cbec..062a2929 100644 --- a/screen-write.c +++ b/screen-write.c @@ -184,10 +184,10 @@ screen_write_initctx(struct screen_write_ctx *ctx, struct tty_ctx *ttyctx, } if (ctx->wp != NULL && - !ctx->sync && + (~ctx->flags & SCREEN_WRITE_SYNC) && (sync || ctx->wp != ctx->wp->window->active)) { tty_write(tty_cmd_syncstart, ttyctx); - ctx->sync = 1; + ctx->flags |= SCREEN_WRITE_SYNC; } } diff --git a/tmux.h b/tmux.h index a708a609..99600f37 100644 --- a/tmux.h +++ b/tmux.h @@ -798,7 +798,9 @@ typedef void (*screen_write_init_ctx_cb)(struct screen_write_ctx *, struct screen_write_ctx { struct window_pane *wp; struct screen *s; - int sync; + + int flags; +#define SCREEN_WRITE_SYNC 0x1 screen_write_init_ctx_cb init_ctx_cb; void *arg;