When entering or leaving the alternate screen, discard any pending

resizes. Improves flicking with scrollbars and programs that leave and
enter the alternate screen on every WINCH like nano. GitHub issue 4772.

Cvs: ----------------------------------------------------------------------
This commit is contained in:
nicm
2026-06-08 20:41:21 +00:00
parent 34fd261a4f
commit fe986a52d6
4 changed files with 24 additions and 14 deletions

View File

@@ -2765,16 +2765,22 @@ void
screen_write_alternateon(struct screen_write_ctx *ctx, struct grid_cell *gc,
int cursor)
{
struct tty_ctx ttyctx;
struct window_pane *wp = ctx->wp;
struct tty_ctx ttyctx;
struct window_pane *wp = ctx->wp;
struct window_pane_resize *r, *r1;
if (wp != NULL && !options_get_number(wp->options, "alternate-screen"))
return;
screen_write_collect_flush(ctx, 0, __func__);
screen_alternate_on(ctx->s, gc, cursor);
if (!screen_alternate_on(ctx->s, gc, cursor))
return;
if (wp != NULL) {
TAILQ_FOREACH_SAFE (r, &wp->resize_queue, entry, r1) {
TAILQ_REMOVE(&wp->resize_queue, r, entry);
free(r);
}
layout_fix_panes(wp->window, NULL);
server_redraw_window_borders(wp->window);
}
@@ -2796,7 +2802,8 @@ screen_write_alternateoff(struct screen_write_ctx *ctx, struct grid_cell *gc,
return;
screen_write_collect_flush(ctx, 0, __func__);
screen_alternate_off(ctx->s, gc, cursor);
if (!screen_alternate_off(ctx->s, gc, cursor))
return;
if (wp != NULL) {
layout_fix_panes(wp->window, NULL);