diff --git a/grid.c b/grid.c index 53c8c2cb0..ff6db357b 100644 --- a/grid.c +++ b/grid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: grid.c,v 1.156 2026/08/03 12:58:53 nicm Exp $ */ +/* $OpenBSD: grid.c,v 1.157 2026/08/28 08:11:08 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -1635,7 +1635,7 @@ grid_wrap_position(struct grid *gd, u_int px, u_int py, u_int *wx, u_int *wy) void grid_unwrap_position(struct grid *gd, u_int *px, u_int *py, u_int wx, u_int wy) { - u_int yy, ay = 0; + u_int yy, ay = 0, ey = gd->hsize + gd->sy - 1; for (yy = 0; yy < gd->hsize + gd->sy - 1; yy++) { if (ay == wy) @@ -1649,7 +1649,7 @@ grid_unwrap_position(struct grid *gd, u_int *px, u_int *py, u_int wx, u_int wy) * until we find the end or the line now containing wx. */ if (wx == UINT_MAX) { - while (gd->linedata[yy].flags & GRID_LINE_WRAPPED) + while (yy < ey && gd->linedata[yy].flags & GRID_LINE_WRAPPED) yy++; wx = gd->linedata[yy].cellused; } else { diff --git a/popup.c b/popup.c index 3bc7eafa6..0345fa367 100644 --- a/popup.c +++ b/popup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: popup.c,v 1.76 2026/07/14 19:07:03 nicm Exp $ */ +/* $OpenBSD: popup.c,v 1.77 2026/08/28 08:02:16 nicm Exp $ */ /* * Copyright (c) 2020 Nicholas Marriott @@ -79,7 +79,8 @@ popup_free(struct popup_data *pd) if (pd->job != NULL) job_free(pd->job); - input_free(pd->ictx); + if (pd->ictx != NULL) + input_free(pd->ictx); free(pd->r.ranges); screen_free(&pd->s);