From a02e25ba01ebe85125c198b5115195e0d837d756 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sat, 4 Jul 2026 17:00:28 +0100 Subject: [PATCH] Do not invoke clear check on respawn. --- grid.c | 30 ------------------------------ screen.c | 7 ++++--- spawn.c | 2 +- tmux.h | 2 +- 4 files changed, 6 insertions(+), 35 deletions(-) diff --git a/grid.c b/grid.c index bc7abd4ed..d03352f08 100644 --- a/grid.c +++ b/grid.c @@ -60,21 +60,6 @@ static const struct grid_cell_entry grid_cleared_entry = { }; #ifdef __APPLE__ -static void -grid_check_lines(struct grid *gd) -{ - u_int i, j; - - for (i = 0; i < gd->hsize + gd->sy; i++) { - for (j = i + 1; j < gd->hsize + gd->sy; j++) { - if (gd->linedata[i].celldata != NULL) - assert(gd->linedata[i].celldata != gd->linedata[j].celldata); - if (gd->linedata[i].extddata != NULL) - assert(gd->linedata[i].extddata != gd->linedata[j].extddata); - } - } -} - void grid_check_is_clear(struct grid *gd) { @@ -104,11 +89,6 @@ grid_check_is_clear(struct grid *gd) } } #else -static void -grid_check_lines(__unused struct grid *gd) -{ -} - void grid_check_is_clear(__unused struct grid *gd) { @@ -506,8 +486,6 @@ grid_scroll_history(struct grid *gd, u_int bg) gd->linedata[gd->hsize].time = current_time; gd->hsize++; gd->scroll_added++; - - grid_check_lines(gd); } /* Clear the history. */ @@ -557,8 +535,6 @@ grid_scroll_history_region(struct grid *gd, u_int upper, u_int lower, u_int bg) gd->hscrolled++; gd->hsize++; gd->scroll_added++; - - grid_check_lines(gd); } /* Expand line to fit to cell. */ @@ -820,8 +796,6 @@ grid_move_lines(struct grid *gd, u_int dy, u_int py, u_int ny, u_int bg) } if (py != 0 && (py < dy || py >= dy + ny)) gd->linedata[py - 1].flags &= ~GRID_LINE_WRAPPED; - - grid_check_lines(gd); } /* Move a group of cells. */ @@ -1311,8 +1285,6 @@ grid_duplicate_lines(struct grid *dst, u_int dy, struct grid *src, u_int sy, sy++; dy++; } - - grid_check_lines(dst); } /* Mark line as dead. */ @@ -1609,8 +1581,6 @@ grid_reflow(struct grid *gd, u_int sx) gd->linedata = target->linedata; free(target); gd->scroll_generation++; - - grid_check_lines(gd); } /* Convert to position based on wrapped lines. */ diff --git a/screen.c b/screen.c index f3fdfcbd4..62a079270 100644 --- a/screen.c +++ b/screen.c @@ -99,12 +99,12 @@ screen_init(struct screen *s, u_int sx, u_int sy, u_int hlimit) s->write_list = NULL; s->hyperlinks = NULL; - screen_reinit(s); + screen_reinit(s, 1); } /* Reinitialise screen. */ void -screen_reinit(struct screen *s) +screen_reinit(struct screen *s, int check) { s->cx = 0; s->cy = 0; @@ -123,7 +123,8 @@ screen_reinit(struct screen *s) s->saved_cy = UINT_MAX; screen_reset_tabs(s); - grid_check_is_clear(s->grid); + if (check) + grid_check_is_clear(s->grid); grid_clear_lines(s->grid, s->grid->hsize, s->grid->sy, 8); screen_clear_selection(s); diff --git a/spawn.c b/spawn.c index e1ef0090b..3ae9153b8 100644 --- a/spawn.c +++ b/spawn.c @@ -273,7 +273,7 @@ spawn_pane(struct spawn_context *sc, char **cause) sc->wp0->fd = -1; } window_pane_reset_mode_all(sc->wp0); - screen_reinit(&sc->wp0->base); + screen_reinit(&sc->wp0->base, 0); if (sc->wp0->ictx != NULL) { input_free(sc->wp0->ictx); sc->wp0->ictx = NULL; diff --git a/tmux.h b/tmux.h index 503c551a1..f49ab377d 100644 --- a/tmux.h +++ b/tmux.h @@ -3502,7 +3502,7 @@ int redraw_get_status_border_cell_type(struct redraw_span **, u_int); /* screen.c */ void screen_init(struct screen *, u_int, u_int, u_int); -void screen_reinit(struct screen *); +void screen_reinit(struct screen *, int); void screen_free(struct screen *); void screen_reset_tabs(struct screen *); void screen_reset_hyperlinks(struct screen *);