From 74865efddb63bdbc6cb9a574dc0817f9e0863ef8 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 27 Feb 2020 21:31:42 +0530 Subject: [PATCH] move break condition into for loop --- kitty/screen.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kitty/screen.c b/kitty/screen.c index 94688f1ef..64a73f599 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -1695,8 +1695,7 @@ static inline void apply_selection(Screen *self, uint8_t *data, const Selection *s, IterationData *last_rendered, uint8_t set_mask) { iteration_data(self, s, last_rendered, 0, true); - for (int y = last_rendered->y; y < last_rendered->y_limit; y++) { - if (y > (int)self->lines - 1) break; + for (int y = last_rendered->y; y < last_rendered->y_limit && y < (int)self->lines; y++) { Line *line = visual_line_(self, y); uint8_t *line_start = data + self->columns * y; XRange xr = xrange_for_iteration(last_rendered, y, line);