-/* $OpenBSD: screen-write.c,v 1.198 2021/08/12 11:35:53 nicm Exp $ */
+/* $OpenBSD: screen-write.c,v 1.199 2021/08/17 08:44:52 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
}
}
- if (ctx->wp != NULL &&
- (~ctx->flags & SCREEN_WRITE_SYNC) &&
- (sync || ctx->wp != ctx->wp->window->active)) {
+ if (~ctx->flags & SCREEN_WRITE_SYNC) {
+ /*
+ * For the active pane or for an overlay (no pane), we want to
+ * only use synchronized updates if requested (commands that
+ * move the cursor); for other panes, always use it, since the
+ * cursor will have to move.
+ */
+ if (ctx->wp != NULL) {
+ if (ctx->wp != ctx->wp->window->active)
+ ttyctx->num = 1;
+ else
+ ttyctx->num = sync;
+ } else
+ ttyctx->num = 0x10|sync;
tty_write(tty_cmd_syncstart, ttyctx);
ctx->flags |= SCREEN_WRITE_SYNC;
}
-/* $OpenBSD: tty.c,v 1.401 2021/08/13 18:54:54 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.402 2021/08/17 08:44:52 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
}
void
-tty_cmd_syncstart(struct tty *tty, __unused const struct tty_ctx *ctx)
+tty_cmd_syncstart(struct tty *tty, const struct tty_ctx *ctx)
{
- tty_sync_start(tty);
+ if (ctx->num == 0x11) {
+ /*
+ * This is an overlay and a command that moves, the cursor so
+ * start synchronized updates.
+ */
+ tty_sync_start(tty);
+ } else if (~ctx->num & 0x10) {
+ /*
+ * This is a pane. If there is an overlay, always start;
+ * otherwise, only if requested.
+ */
+ if (ctx->num || tty->client->overlay_draw != NULL)
+ tty_sync_start(tty);
+ }
}
void