From 8a8f139084717f31b1e7eb9bfaf11a7b8bac7366 Mon Sep 17 00:00:00 2001 From: Andrew Hamilton Date: Thu, 10 Jun 2021 01:55:42 +1000 Subject: [PATCH] Fix glitch when scrolling the listing with mouse. - Stopped the scroll position going negative. --- eris/__main__.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/eris/__main__.py b/eris/__main__.py index 3d66e8d..e4b46e4 100755 --- a/eris/__main__.py +++ b/eris/__main__.py @@ -762,17 +762,16 @@ class Screen: dx, dy = vector selected_widget = self._summary.get_selection() x, y = selected_widget.scroll_position - if dy < 0 or dx < 0: # up or left - x, y = max(x + dx, 0), max(y + dy, 0) - else: # down or right - widget_width, widget_height = fill3.appearance_dimensions( - selected_widget.result.appearance_min()) - listing_width, listing_height = (self._listing.widget. - last_dimensions) - listing_width -= 1 # scrollbars - listing_height -= 1 - x = min(x + dx, max(widget_width - listing_width, 0)) - y = min(y + dy, max(widget_height - listing_height, 0)) + widget_width, widget_height = fill3.appearance_dimensions( + selected_widget.result.appearance_min()) + listing_width, listing_height = (self._listing.widget. + last_dimensions) + listing_width -= 1 # scrollbars + listing_height -= 1 + x = min(x + dx, max(widget_width - listing_width, 0)) + y = min(y + dy, max(widget_height - listing_height, 0)) + x = max(0, x) + y = max(0, y) selected_widget.scroll_position = x, y def cursor_up(self):