From bbf743769bf0e71dbd6c0cc96aa6817662b939e1 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 8 Sep 2010 20:36:42 +0000 Subject: [PATCH] Do not crash if the screen size is too small for the indicator in copy mode. --- window-copy.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/window-copy.c b/window-copy.c index 186f018d..5ab163cc 100644 --- a/window-copy.c +++ b/window-copy.c @@ -1055,6 +1055,8 @@ window_copy_write_line( if (py == 0) { size = xsnprintf(hdr, sizeof hdr, "[%u/%u]", data->oy, screen_hsize(data->backing)); + if (size > screen_size_x(s)) + size = screen_size_x(s); screen_write_cursormove(ctx, screen_size_x(s) - size, 0); screen_write_puts(ctx, &gc, "%s", hdr); } else if (py == last && data->inputtype != WINDOW_COPY_OFF) {