mirror of
https://github.com/openbsd/src.git
synced 2026-06-18 07:13:36 +02:00
When MODE_SYNC is on, all terminal updates need to deferred, not just
scrolling. Check the flag before each one. GitHub issue 4983.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: screen-write.c,v 1.267 2026/06/11 14:19:59 nicm Exp $ */
|
||||
/* $OpenBSD: screen-write.c,v 1.268 2026/06/11 19:50:23 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@@ -1158,7 +1158,8 @@ screen_write_redraw_line(struct screen_write_ctx *ctx, struct tty_ctx *ttyctx,
|
||||
|
||||
ttyctx->ocx = cx;
|
||||
ttyctx->ocy = yy;
|
||||
tty_write(tty_cmd_cell, ttyctx);
|
||||
if (~s->mode & MODE_SYNC)
|
||||
tty_write(tty_cmd_cell, ttyctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1200,6 +1201,8 @@ screen_write_alignmenttest(struct screen_write_ctx *ctx)
|
||||
|
||||
screen_write_initctx(ctx, &ttyctx, 1, 1);
|
||||
|
||||
if (s->mode & MODE_SYNC)
|
||||
return;
|
||||
if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED || ctx->wp == NULL) {
|
||||
tty_write(tty_cmd_alignmenttest, &ttyctx);
|
||||
return;
|
||||
@@ -1234,6 +1237,8 @@ screen_write_insertcharacter(struct screen_write_ctx *ctx, u_int nx, u_int bg)
|
||||
screen_write_collect_flush(ctx, 0, __func__);
|
||||
ttyctx.n = nx;
|
||||
|
||||
if (s->mode & MODE_SYNC)
|
||||
return;
|
||||
if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED || ctx->wp == NULL) {
|
||||
tty_write(tty_cmd_insertcharacter, &ttyctx);
|
||||
return;
|
||||
@@ -1268,6 +1273,8 @@ screen_write_deletecharacter(struct screen_write_ctx *ctx, u_int nx, u_int bg)
|
||||
screen_write_collect_flush(ctx, 0, __func__);
|
||||
ttyctx.n = nx;
|
||||
|
||||
if (s->mode & MODE_SYNC)
|
||||
return;
|
||||
if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED || ctx->wp == NULL) {
|
||||
tty_write(tty_cmd_deletecharacter, &ttyctx);
|
||||
return;
|
||||
@@ -1302,6 +1309,8 @@ screen_write_clearcharacter(struct screen_write_ctx *ctx, u_int nx, u_int bg)
|
||||
screen_write_collect_flush(ctx, 0, __func__);
|
||||
ttyctx.n = nx;
|
||||
|
||||
if (s->mode & MODE_SYNC)
|
||||
return;
|
||||
if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED || ctx->wp == NULL) {
|
||||
tty_write(tty_cmd_clearcharacter, &ttyctx);
|
||||
return;
|
||||
@@ -1336,6 +1345,8 @@ screen_write_insertline(struct screen_write_ctx *ctx, u_int ny, u_int bg)
|
||||
screen_write_collect_flush(ctx, 0, __func__);
|
||||
ttyctx.n = ny;
|
||||
|
||||
if (s->mode & MODE_SYNC)
|
||||
return;
|
||||
if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED || ctx->wp == NULL) {
|
||||
tty_write(tty_cmd_insertline, &ttyctx);
|
||||
return;
|
||||
@@ -1361,6 +1372,8 @@ screen_write_insertline(struct screen_write_ctx *ctx, u_int ny, u_int bg)
|
||||
screen_write_collect_flush(ctx, 0, __func__);
|
||||
ttyctx.n = ny;
|
||||
|
||||
if (s->mode & MODE_SYNC)
|
||||
return;
|
||||
if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED || ctx->wp == NULL) {
|
||||
tty_write(tty_cmd_insertline, &ttyctx);
|
||||
return;
|
||||
@@ -1395,6 +1408,8 @@ screen_write_deleteline(struct screen_write_ctx *ctx, u_int ny, u_int bg)
|
||||
screen_write_collect_flush(ctx, 0, __func__);
|
||||
ttyctx.n = ny;
|
||||
|
||||
if (s->mode & MODE_SYNC)
|
||||
return;
|
||||
if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED || ctx->wp == NULL) {
|
||||
tty_write(tty_cmd_deleteline, &ttyctx);
|
||||
return;
|
||||
@@ -1420,6 +1435,8 @@ screen_write_deleteline(struct screen_write_ctx *ctx, u_int ny, u_int bg)
|
||||
screen_write_collect_flush(ctx, 0, __func__);
|
||||
ttyctx.n = ny;
|
||||
|
||||
if (s->mode & MODE_SYNC)
|
||||
return;
|
||||
if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED || ctx->wp == NULL) {
|
||||
tty_write(tty_cmd_deleteline, &ttyctx);
|
||||
return;
|
||||
@@ -1541,6 +1558,8 @@ screen_write_reverseindex(struct screen_write_ctx *ctx, u_int bg)
|
||||
screen_write_initctx(ctx, &ttyctx, 1, 1);
|
||||
ttyctx.bg = bg;
|
||||
|
||||
if (s->mode & MODE_SYNC)
|
||||
return;
|
||||
if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED || ctx->wp == NULL) {
|
||||
tty_write(tty_cmd_reverseindex, &ttyctx);
|
||||
return;
|
||||
@@ -1651,6 +1670,8 @@ screen_write_scrolldown(struct screen_write_ctx *ctx, u_int lines, u_int bg)
|
||||
screen_write_collect_flush(ctx, 0, __func__);
|
||||
ttyctx.n = lines;
|
||||
|
||||
if (s->mode & MODE_SYNC)
|
||||
return;
|
||||
if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED || ctx->wp == NULL) {
|
||||
tty_write(tty_cmd_scrolldown, &ttyctx);
|
||||
return;
|
||||
@@ -1697,6 +1718,8 @@ screen_write_clearendofscreen(struct screen_write_ctx *ctx, u_int bg)
|
||||
screen_write_collect_clear(ctx, s->cy + 1, sy - (s->cy + 1));
|
||||
screen_write_collect_flush(ctx, 0, __func__);
|
||||
|
||||
if (s->mode & MODE_SYNC)
|
||||
return;
|
||||
if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED) {
|
||||
tty_write(tty_cmd_clearendofscreen, &ttyctx);
|
||||
return;
|
||||
@@ -1766,6 +1789,8 @@ screen_write_clearstartofscreen(struct screen_write_ctx *ctx, u_int bg)
|
||||
screen_write_collect_clear(ctx, 0, s->cy);
|
||||
screen_write_collect_flush(ctx, 0, __func__);
|
||||
|
||||
if (s->mode & MODE_SYNC)
|
||||
return;
|
||||
if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED) {
|
||||
tty_write(tty_cmd_clearstartofscreen, &ttyctx);
|
||||
return;
|
||||
@@ -1834,6 +1859,8 @@ screen_write_clearscreen(struct screen_write_ctx *ctx, u_int bg)
|
||||
|
||||
screen_write_collect_clear(ctx, 0, sy);
|
||||
|
||||
if (s->mode & MODE_SYNC)
|
||||
return;
|
||||
if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED) {
|
||||
tty_write(tty_cmd_clearscreen, &ttyctx);
|
||||
return;
|
||||
@@ -2482,7 +2509,8 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
|
||||
if (s->mode & MODE_INSERT) {
|
||||
screen_write_collect_flush(ctx, 0, __func__);
|
||||
ttyctx.n = width;
|
||||
tty_write(tty_cmd_insertcharacter, &ttyctx);
|
||||
if (~s->mode & MODE_SYNC)
|
||||
tty_write(tty_cmd_insertcharacter, &ttyctx);
|
||||
}
|
||||
|
||||
/* If not writing, done now. */
|
||||
@@ -2506,7 +2534,8 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
|
||||
for (i = 0, vis = 0; i < r->used; i++)
|
||||
vis += r->ranges[i].nx;
|
||||
if (vis >= width) {
|
||||
tty_write(tty_cmd_cell, &ttyctx);
|
||||
if (~s->mode & MODE_SYNC)
|
||||
tty_write(tty_cmd_cell, &ttyctx);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2515,6 +2544,8 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
|
||||
* spaces in the visible regions.
|
||||
*/
|
||||
utf8_set(&tmp_gc.data, ' ');
|
||||
if (s->mode & MODE_SYNC)
|
||||
return;
|
||||
for (i = 0; i < r->used; i++) {
|
||||
ri = &r->ranges[i];
|
||||
if (ri->nx == 0)
|
||||
@@ -2656,7 +2687,8 @@ screen_write_combine(struct screen_write_ctx *ctx, const struct grid_cell *gc)
|
||||
ttyctx.cell = &last;
|
||||
if (force_wide)
|
||||
ttyctx.flags |= TTY_CTX_CELL_INVALIDATE;
|
||||
tty_write(tty_cmd_cell, &ttyctx);
|
||||
if (~s->mode & MODE_SYNC)
|
||||
tty_write(tty_cmd_cell, &ttyctx);
|
||||
screen_write_set_cursor(ctx, cx, cy);
|
||||
|
||||
return (1);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: server-client.c,v 1.466 2026/06/11 19:13:34 nicm Exp $ */
|
||||
/* $OpenBSD: server-client.c,v 1.467 2026/06/11 19:50:23 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@@ -1779,7 +1779,7 @@ server_client_reset_state(struct client *c)
|
||||
struct window_pane *wp = server_client_get_pane(c), *loop;
|
||||
struct screen *s = NULL;
|
||||
struct options *oo = c->session->options;
|
||||
int mode = 0, cursor, flags;
|
||||
int mode = 0, cursor, flags, pane_mode = 0;
|
||||
u_int cx = 0, cy = 0, ox, oy, sx, sy, n;
|
||||
struct visible_ranges *r;
|
||||
|
||||
@@ -1824,6 +1824,8 @@ server_client_reset_state(struct client *c)
|
||||
cx = c->prompt_cursor;
|
||||
} else if (wp != NULL && c->overlay_draw == NULL) {
|
||||
cursor = 0;
|
||||
pane_mode = wp->base.mode;
|
||||
|
||||
tty_window_offset(tty, &ox, &oy, &sx, &sy);
|
||||
if (wp->xoff + (int)s->cx >= (int)ox &&
|
||||
wp->xoff + (int)s->cx <= (int)ox + (int)sx &&
|
||||
@@ -1842,13 +1844,14 @@ server_client_reset_state(struct client *c)
|
||||
cy += status_line_size(c);
|
||||
}
|
||||
|
||||
if (!cursor)
|
||||
if ((pane_mode & MODE_SYNC) || !cursor)
|
||||
mode &= ~MODE_CURSOR;
|
||||
} else if (c->overlay_mode == NULL || s == NULL)
|
||||
mode &= ~MODE_CURSOR;
|
||||
|
||||
log_debug("%s: cursor to %u,%u", __func__, cx, cy);
|
||||
tty_cursor(tty, cx, cy);
|
||||
if (~pane_mode & MODE_SYNC) {
|
||||
log_debug("%s: cursor to %u,%u", __func__, cx, cy);
|
||||
tty_cursor(tty, cx, cy);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set mouse mode if requested. To support dragging, always use button
|
||||
|
||||
Reference in New Issue
Block a user