Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam
2026-06-11 21:15:06 +01:00
2 changed files with 44 additions and 9 deletions

View File

@@ -1158,7 +1158,8 @@ screen_write_redraw_line(struct screen_write_ctx *ctx, struct tty_ctx *ttyctx,
ttyctx->ocx = cx; ttyctx->ocx = cx;
ttyctx->ocy = yy; ttyctx->ocy = yy;
tty_write(tty_cmd_cell, ttyctx); if (~s->mode & MODE_SYNC)
tty_write(tty_cmd_cell, ttyctx);
} }
} }
} }
@@ -1205,6 +1206,8 @@ screen_write_alignmenttest(struct screen_write_ctx *ctx)
screen_write_initctx(ctx, &ttyctx, 1, 1); screen_write_initctx(ctx, &ttyctx, 1, 1);
if (s->mode & MODE_SYNC)
return;
if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED || ctx->wp == NULL) { if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED || ctx->wp == NULL) {
tty_write(tty_cmd_alignmenttest, &ttyctx); tty_write(tty_cmd_alignmenttest, &ttyctx);
return; return;
@@ -1244,6 +1247,8 @@ screen_write_insertcharacter(struct screen_write_ctx *ctx, u_int nx, u_int bg)
screen_write_collect_flush(ctx, 0, __func__); screen_write_collect_flush(ctx, 0, __func__);
ttyctx.n = nx; ttyctx.n = nx;
if (s->mode & MODE_SYNC)
return;
if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED || ctx->wp == NULL) { if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED || ctx->wp == NULL) {
tty_write(tty_cmd_insertcharacter, &ttyctx); tty_write(tty_cmd_insertcharacter, &ttyctx);
return; return;
@@ -1283,6 +1288,8 @@ screen_write_deletecharacter(struct screen_write_ctx *ctx, u_int nx, u_int bg)
screen_write_collect_flush(ctx, 0, __func__); screen_write_collect_flush(ctx, 0, __func__);
ttyctx.n = nx; ttyctx.n = nx;
if (s->mode & MODE_SYNC)
return;
if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED || ctx->wp == NULL) { if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED || ctx->wp == NULL) {
tty_write(tty_cmd_deletecharacter, &ttyctx); tty_write(tty_cmd_deletecharacter, &ttyctx);
return; return;
@@ -1322,6 +1329,8 @@ screen_write_clearcharacter(struct screen_write_ctx *ctx, u_int nx, u_int bg)
screen_write_collect_flush(ctx, 0, __func__); screen_write_collect_flush(ctx, 0, __func__);
ttyctx.n = nx; ttyctx.n = nx;
if (s->mode & MODE_SYNC)
return;
if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED || ctx->wp == NULL) { if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED || ctx->wp == NULL) {
tty_write(tty_cmd_clearcharacter, &ttyctx); tty_write(tty_cmd_clearcharacter, &ttyctx);
return; return;
@@ -1361,6 +1370,8 @@ screen_write_insertline(struct screen_write_ctx *ctx, u_int ny, u_int bg)
screen_write_collect_flush(ctx, 0, __func__); screen_write_collect_flush(ctx, 0, __func__);
ttyctx.n = ny; ttyctx.n = ny;
if (s->mode & MODE_SYNC)
return;
if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED || ctx->wp == NULL) { if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED || ctx->wp == NULL) {
tty_write(tty_cmd_insertline, &ttyctx); tty_write(tty_cmd_insertline, &ttyctx);
return; return;
@@ -1386,6 +1397,8 @@ screen_write_insertline(struct screen_write_ctx *ctx, u_int ny, u_int bg)
screen_write_collect_flush(ctx, 0, __func__); screen_write_collect_flush(ctx, 0, __func__);
ttyctx.n = ny; ttyctx.n = ny;
if (s->mode & MODE_SYNC)
return;
if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED || ctx->wp == NULL) { if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED || ctx->wp == NULL) {
tty_write(tty_cmd_insertline, &ttyctx); tty_write(tty_cmd_insertline, &ttyctx);
return; return;
@@ -1425,6 +1438,8 @@ screen_write_deleteline(struct screen_write_ctx *ctx, u_int ny, u_int bg)
screen_write_collect_flush(ctx, 0, __func__); screen_write_collect_flush(ctx, 0, __func__);
ttyctx.n = ny; ttyctx.n = ny;
if (s->mode & MODE_SYNC)
return;
if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED || ctx->wp == NULL) { if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED || ctx->wp == NULL) {
tty_write(tty_cmd_deleteline, &ttyctx); tty_write(tty_cmd_deleteline, &ttyctx);
return; return;
@@ -1450,6 +1465,8 @@ screen_write_deleteline(struct screen_write_ctx *ctx, u_int ny, u_int bg)
screen_write_collect_flush(ctx, 0, __func__); screen_write_collect_flush(ctx, 0, __func__);
ttyctx.n = ny; ttyctx.n = ny;
if (s->mode & MODE_SYNC)
return;
if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED || ctx->wp == NULL) { if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED || ctx->wp == NULL) {
tty_write(tty_cmd_deleteline, &ttyctx); tty_write(tty_cmd_deleteline, &ttyctx);
return; return;
@@ -1591,6 +1608,8 @@ screen_write_reverseindex(struct screen_write_ctx *ctx, u_int bg)
screen_write_initctx(ctx, &ttyctx, 1, 1); screen_write_initctx(ctx, &ttyctx, 1, 1);
ttyctx.bg = bg; ttyctx.bg = bg;
if (s->mode & MODE_SYNC)
return;
if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED || ctx->wp == NULL) { if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED || ctx->wp == NULL) {
tty_write(tty_cmd_reverseindex, &ttyctx); tty_write(tty_cmd_reverseindex, &ttyctx);
return; return;
@@ -1722,6 +1741,8 @@ screen_write_scrolldown(struct screen_write_ctx *ctx, u_int lines, u_int bg)
screen_write_collect_flush(ctx, 0, __func__); screen_write_collect_flush(ctx, 0, __func__);
ttyctx.n = lines; ttyctx.n = lines;
if (s->mode & MODE_SYNC)
return;
if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED || ctx->wp == NULL) { if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED || ctx->wp == NULL) {
tty_write(tty_cmd_scrolldown, &ttyctx); tty_write(tty_cmd_scrolldown, &ttyctx);
return; return;
@@ -1773,6 +1794,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_clear(ctx, s->cy + 1, sy - (s->cy + 1));
screen_write_collect_flush(ctx, 0, __func__); screen_write_collect_flush(ctx, 0, __func__);
if (s->mode & MODE_SYNC)
return;
if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED) { if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED) {
tty_write(tty_cmd_clearendofscreen, &ttyctx); tty_write(tty_cmd_clearendofscreen, &ttyctx);
return; return;
@@ -1847,6 +1870,8 @@ screen_write_clearstartofscreen(struct screen_write_ctx *ctx, u_int bg)
screen_write_collect_clear(ctx, 0, s->cy); screen_write_collect_clear(ctx, 0, s->cy);
screen_write_collect_flush(ctx, 0, __func__); screen_write_collect_flush(ctx, 0, __func__);
if (s->mode & MODE_SYNC)
return;
if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED) { if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED) {
tty_write(tty_cmd_clearstartofscreen, &ttyctx); tty_write(tty_cmd_clearstartofscreen, &ttyctx);
return; return;
@@ -1920,6 +1945,8 @@ screen_write_clearscreen(struct screen_write_ctx *ctx, u_int bg)
screen_write_collect_clear(ctx, 0, sy); screen_write_collect_clear(ctx, 0, sy);
if (s->mode & MODE_SYNC)
return;
if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED) { if (~ttyctx.flags & TTY_CTX_PANE_OBSCURED) {
tty_write(tty_cmd_clearscreen, &ttyctx); tty_write(tty_cmd_clearscreen, &ttyctx);
return; return;
@@ -2573,7 +2600,8 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
if (s->mode & MODE_INSERT) { if (s->mode & MODE_INSERT) {
screen_write_collect_flush(ctx, 0, __func__); screen_write_collect_flush(ctx, 0, __func__);
ttyctx.n = width; 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. */ /* If not writing, done now. */
@@ -2597,7 +2625,8 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
for (i = 0, vis = 0; i < r->used; i++) for (i = 0, vis = 0; i < r->used; i++)
vis += r->ranges[i].nx; vis += r->ranges[i].nx;
if (vis >= width) { if (vis >= width) {
tty_write(tty_cmd_cell, &ttyctx); if (~s->mode & MODE_SYNC)
tty_write(tty_cmd_cell, &ttyctx);
return; return;
} }
@@ -2606,6 +2635,8 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
* spaces in the visible regions. * spaces in the visible regions.
*/ */
utf8_set(&tmp_gc.data, ' '); utf8_set(&tmp_gc.data, ' ');
if (s->mode & MODE_SYNC)
return;
for (i = 0; i < r->used; i++) { for (i = 0; i < r->used; i++) {
ri = &r->ranges[i]; ri = &r->ranges[i];
if (ri->nx == 0) if (ri->nx == 0)
@@ -2747,7 +2778,8 @@ screen_write_combine(struct screen_write_ctx *ctx, const struct grid_cell *gc)
ttyctx.cell = &last; ttyctx.cell = &last;
if (force_wide) if (force_wide)
ttyctx.flags |= TTY_CTX_CELL_INVALIDATE; 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); screen_write_set_cursor(ctx, cx, cy);
return (1); return (1);

View File

@@ -1775,7 +1775,7 @@ server_client_reset_state(struct client *c)
struct window_pane *wp = server_client_get_pane(c), *loop; struct window_pane *wp = server_client_get_pane(c), *loop;
struct screen *s = NULL; struct screen *s = NULL;
struct options *oo = c->session->options; 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; u_int cx = 0, cy = 0, ox, oy, sx, sy, n;
struct visible_ranges *r; struct visible_ranges *r;
@@ -1820,6 +1820,8 @@ server_client_reset_state(struct client *c)
cx = c->prompt_cursor; cx = c->prompt_cursor;
} else if (wp != NULL && c->overlay_draw == NULL) { } else if (wp != NULL && c->overlay_draw == NULL) {
cursor = 0; cursor = 0;
pane_mode = wp->base.mode;
tty_window_offset(tty, &ox, &oy, &sx, &sy); tty_window_offset(tty, &ox, &oy, &sx, &sy);
if (wp->xoff + (int)s->cx >= (int)ox && if (wp->xoff + (int)s->cx >= (int)ox &&
wp->xoff + (int)s->cx <= (int)ox + (int)sx && wp->xoff + (int)s->cx <= (int)ox + (int)sx &&
@@ -1838,13 +1840,14 @@ server_client_reset_state(struct client *c)
cy += status_line_size(c); cy += status_line_size(c);
} }
if (!cursor) if ((pane_mode & MODE_SYNC) || !cursor)
mode &= ~MODE_CURSOR; mode &= ~MODE_CURSOR;
} else if (c->overlay_mode == NULL || s == NULL) } else if (c->overlay_mode == NULL || s == NULL)
mode &= ~MODE_CURSOR; mode &= ~MODE_CURSOR;
if (~pane_mode & MODE_SYNC) {
log_debug("%s: cursor to %u,%u", __func__, cx, cy); log_debug("%s: cursor to %u,%u", __func__, cx, cy);
tty_cursor(tty, cx, cy); tty_cursor(tty, cx, cy);
}
/* /*
* Set mouse mode if requested. To support dragging, always use button * Set mouse mode if requested. To support dragging, always use button