diff --git a/window-copy.c b/window-copy.c index 4ee3d4e3..63c31829 100644 --- a/window-copy.c +++ b/window-copy.c @@ -504,6 +504,8 @@ window_copy_search_rl(struct grid *gd, u_int ax, bx, px; for (ax = last + 1; ax > first; ax--) { + if (gd->sx - (ax - 1) < sgd->sx) + continue; for (bx = 0; bx < sgd->sx; bx++) { px = ax - 1 + bx; if (!window_copy_search_compare(gd, px, py, sgd, bx))