From 1603310b86188daee95196c09886eddd3d94284e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 25 Jan 2018 20:50:34 +0530 Subject: [PATCH] Fix off-by-one when iterating over selections that stretch into the history buf Fixes #295 --- kitty/screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kitty/screen.c b/kitty/screen.c index efae584e5..bdbbdb7e8 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -1298,7 +1298,7 @@ visual_line_(Screen *self, index_type y) { static inline Line* range_line_(Screen *self, int y) { if (y < 0) { - historybuf_init_line(self->historybuf, -y, self->historybuf->line); + historybuf_init_line(self->historybuf, -(y + 1), self->historybuf->line); return self->historybuf->line; } linebuf_init_line(self->linebuf, y);