From 49eb692a03259edefe1028ce19eba1be54895d56 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 2 Dec 2016 18:20:14 +0530 Subject: [PATCH] Fix an off-by-one error for the scroll limit --- kitty/char_grid.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kitty/char_grid.py b/kitty/char_grid.py index 9a39f17a6..6466c633b 100644 --- a/kitty/char_grid.py +++ b/kitty/char_grid.py @@ -234,7 +234,7 @@ class CharGrid: amt = {'line': 1, 'page': self.screen.lines - 1, 'full': self.screen.historybuf.count}[amt] if not upwards: amt *= -1 - y = max(0, min(self.scrolled_by + amt, self.screen.historybuf.count)) + y = max(0, min(self.scrolled_by + amt, self.screen.historybuf.count - 1)) if y != self.scrolled_by: self.scrolled_by = y self.update_cell_data() @@ -246,7 +246,7 @@ class CharGrid: cursor_changed, history_line_added_count = self.screen.update_cell_data( sprites.backend, self.color_profile, addressof(self.main_sprite_map), self.default_fg, self.default_bg, force_full_refresh) if self.scrolled_by: - self.scrolled_by = min(self.scrolled_by + history_line_added_count, self.screen.historybuf.count) + self.scrolled_by = min(self.scrolled_by + history_line_added_count, self.screen.historybuf.count - 1) self.screen.set_scroll_cell_data( sprites.backend, self.color_profile, addressof(self.main_sprite_map), self.default_fg, self.default_bg, self.scrolled_by, addressof(self.scroll_sprite_map))