From 7a2ea39a3e22ea154efc3f6ff11f2c7b2d6593a8 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 12 Oct 2026 10:50:06 +0000 Subject: [PATCH] Keep the row RM 1049 restores inside the saved grid, from someone in GitHub issue 5724. --- screen.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/screen.c b/screen.c index 2533beb5c..402c4fba2 100644 --- a/screen.c +++ b/screen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: screen.c,v 1.107 2026/07/26 09:20:54 nicm Exp $ */ +/* $OpenBSD: screen.c,v 1.108 2026/10/12 10:50:06 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -717,6 +717,10 @@ screen_alternate_off(struct screen *s, struct grid_cell *gc, int cursor) return 0; } + /* Clamp cursor to the current screen size. */ + if (s->cy > screen_size_y(s) - 1) + s->cy = screen_size_y(s) - 1; + /* Restore the saved grid. */ grid_duplicate_lines(s->grid, screen_hsize(s), s->saved_grid, 0, s->saved_grid->sy);