Add a flag to mark screen_write_ctx as coming from pane input and change

a function argument.
This commit is contained in:
nicm
2026-10-12 18:47:52 +00:00
committed by tmux update bot
parent 0985de0bc6
commit e2eb6b7d87
3 changed files with 15 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: input.c,v 1.274 2026/10/12 17:04:48 nicm Exp $ */ /* $OpenBSD: input.c,v 1.275 2026/10/12 18:47:52 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -936,6 +936,7 @@ input_reset(struct input_ctx *ictx, int clear)
screen_write_start_pane(sctx, wp, &wp->base); screen_write_start_pane(sctx, wp, &wp->base);
else else
screen_write_start(sctx, &wp->base); screen_write_start(sctx, &wp->base);
sctx->flags |= SCREEN_WRITE_INPUT;
screen_write_reset(sctx); screen_write_reset(sctx);
screen_write_stop(sctx); screen_write_stop(sctx);
} }
@@ -1064,6 +1065,7 @@ input_parse_buffer(struct window_pane *wp, const u_char *buf, size_t len)
screen_write_start_pane(sctx, wp, &wp->base); screen_write_start_pane(sctx, wp, &wp->base);
else else
screen_write_start(sctx, &wp->base); screen_write_start(sctx, &wp->base);
sctx->flags |= SCREEN_WRITE_INPUT;
log_debug("%s: %%%u %s, %zu bytes: %.*s", __func__, wp->id, log_debug("%s: %%%u %s, %zu bytes: %.*s", __func__, wp->id,
ictx->state->name, len, (int)len, buf); ictx->state->name, len, (int)len, buf);
@@ -1083,6 +1085,7 @@ input_parse_screen(struct input_ctx *ictx, struct screen *s,
return; return;
screen_write_start_callback(sctx, s, cb, arg); screen_write_start_callback(sctx, s, cb, arg);
sctx->flags |= SCREEN_WRITE_INPUT;
input_parse(ictx, buf, len); input_parse(ictx, buf, len);
screen_write_stop(sctx); screen_write_stop(sctx);
} }

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: screen-write.c,v 1.299 2026/10/05 08:41:23 nicm Exp $ */ /* $OpenBSD: screen-write.c,v 1.300 2026/10/12 18:47:52 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -2564,8 +2564,9 @@ screen_write_collect_insert_clear(struct screen_write_ctx *ctx, u_int px,
* background so the columns it covered do not lose their colour. * background so the columns it covered do not lose their colour.
*/ */
static void static void
screen_write_clear_cell(struct grid *gd, u_int px, u_int py) screen_write_clear_cell(struct screen_write_ctx *ctx, u_int px, u_int py)
{ {
struct grid *gd = ctx->s->grid;
struct grid_cell gc; struct grid_cell gc;
int bg; int bg;
@@ -2630,7 +2631,7 @@ screen_write_collect_end(struct screen_write_ctx *ctx)
grid_view_get_cell(s->grid, xx, s->cy, &gc); grid_view_get_cell(s->grid, xx, s->cy, &gc);
if (~gc.flags & GRID_FLAG_PADDING) if (~gc.flags & GRID_FLAG_PADDING)
break; break;
screen_write_clear_cell(s->grid, xx, s->cy); screen_write_clear_cell(ctx, xx, s->cy);
log_debug("%s: padding erased (before) at %u (cx %u)", log_debug("%s: padding erased (before) at %u (cx %u)",
__func__, xx, s->cx); __func__, xx, s->cx);
} }
@@ -2639,7 +2640,7 @@ screen_write_collect_end(struct screen_write_ctx *ctx)
grid_view_get_cell(s->grid, 0, s->cy, &gc); grid_view_get_cell(s->grid, 0, s->cy, &gc);
if (gc.data.width > 1 || if (gc.data.width > 1 ||
(gc.flags & GRID_FLAG_PADDING)) { (gc.flags & GRID_FLAG_PADDING)) {
screen_write_clear_cell(s->grid, xx, s->cy); screen_write_clear_cell(ctx, xx, s->cy);
log_debug("%s: padding erased (before) at %u " log_debug("%s: padding erased (before) at %u "
"(cx %u)", __func__, xx, s->cx); "(cx %u)", __func__, xx, s->cx);
} }
@@ -2658,7 +2659,7 @@ screen_write_collect_end(struct screen_write_ctx *ctx)
grid_view_get_cell(s->grid, xx, s->cy, &gc); grid_view_get_cell(s->grid, xx, s->cy, &gc);
if (~gc.flags & GRID_FLAG_PADDING) if (~gc.flags & GRID_FLAG_PADDING)
break; break;
screen_write_clear_cell(s->grid, xx, s->cy); screen_write_clear_cell(ctx, xx, s->cy);
log_debug("%s: padding erased (after) at %u (cx %u)", __func__, log_debug("%s: padding erased (after) at %u (cx %u)", __func__,
xx, s->cx); xx, s->cx);
} }
@@ -3085,12 +3086,12 @@ screen_write_overwrite(struct screen_write_ctx *ctx, struct grid_cell *gc,
if (~tmp_gc.flags & GRID_FLAG_PADDING) if (~tmp_gc.flags & GRID_FLAG_PADDING)
break; break;
log_debug("%s: padding at %u,%u", __func__, xx, s->cy); log_debug("%s: padding at %u,%u", __func__, xx, s->cy);
screen_write_clear_cell(gd, xx, s->cy); screen_write_clear_cell(ctx, xx, s->cy);
} }
/* Overwrite the character at the start of this padding. */ /* Overwrite the character at the start of this padding. */
log_debug("%s: character at %u,%u", __func__, xx, s->cy); log_debug("%s: character at %u,%u", __func__, xx, s->cy);
screen_write_clear_cell(gd, xx, s->cy); screen_write_clear_cell(ctx, xx, s->cy);
done = 1; done = 1;
} }
@@ -3108,7 +3109,7 @@ screen_write_overwrite(struct screen_write_ctx *ctx, struct grid_cell *gc,
break; break;
log_debug("%s: overwrite at %u,%u", __func__, xx, log_debug("%s: overwrite at %u,%u", __func__, xx,
s->cy); s->cy);
screen_write_clear_cell(gd, xx, s->cy); screen_write_clear_cell(ctx, xx, s->cy);
done = 1; done = 1;
} }
} }

3
tmux.h
View File

@@ -1,4 +1,4 @@
/* $OpenBSD: tmux.h,v 1.1457 2026/10/12 12:35:03 nicm Exp $ */ /* $OpenBSD: tmux.h,v 1.1458 2026/10/12 18:47:52 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1101,6 +1101,7 @@ struct screen_write_ctx {
#define SCREEN_WRITE_SYNC 0x1 #define SCREEN_WRITE_SYNC 0x1
#define SCREEN_WRITE_OBSCURED 0x2 #define SCREEN_WRITE_OBSCURED 0x2
#define SCREEN_WRITE_CHECKED_IF_OBSCURED 0x4 #define SCREEN_WRITE_CHECKED_IF_OBSCURED 0x4
#define SCREEN_WRITE_INPUT 0x8
screen_write_init_ctx_cb init_ctx_cb; screen_write_init_ctx_cb init_ctx_cb;
void *arg; void *arg;