From 8ecd50848d04bff0b9a69a520535c18e5870af76 Mon Sep 17 00:00:00 2001 From: Andrew Hamilton Date: Sat, 8 Jul 2017 14:22:45 +0100 Subject: [PATCH] Fixed a bug when paging the summary. --- BUGS | 4 ++-- vigil/__main__.py | 12 ++++-------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/BUGS b/BUGS index 16a9997..d93ded5 100644 --- a/BUGS +++ b/BUGS @@ -6,8 +6,6 @@ Current the timed out status when un-paused. - Tmp files are being left behind after shutdown. - All tools in AppImages aren't working correctly. See ./vigil --self_test -- When paging the summary window the cursor line should stay in the same - place on the screen. - Sometimes git_blame produces an error, depending on characters in its input. @@ -252,6 +250,8 @@ Fixed is a glitch in the scrolling. - When paging the summary window, with the bottom scroll bar showing, the cursor line drifts up or down a row. +- When paging the summary window the cursor line should stay in the same + place on the screen. Won't fix diff --git a/vigil/__main__.py b/vigil/__main__.py index a1c32eb..646bac3 100755 --- a/vigil/__main__.py +++ b/vigil/__main__.py @@ -336,7 +336,7 @@ class Summary: return self._highlight_cursor_row( self._view_widget.appearance(dimensions), cursor_y) - def mouse_scroll(self, dx, dy): + def scroll(self, dx, dy): scroll_x, scroll_y = self._view_widget.position dy = min(dy, scroll_y) self._view_widget.position = scroll_x, scroll_y - dy @@ -375,15 +375,11 @@ class Summary: def cursor_page_up(self): view_width, view_height = self._view_widget.portal.last_dimensions - x, y = self._cursor_position - jump = view_height - 1 - self._cursor_position = (x, max(y - jump, 0)) + self.scroll(0, view_height) def cursor_page_down(self): view_width, view_height = self._view_widget.portal.last_dimensions - x, y = self._cursor_position - jump = view_height - 1 - self._cursor_position = (x, min(y + jump, len(self._column) - 1)) + self.scroll(0, -view_height) def cursor_home(self): x, y = self._cursor_position @@ -796,7 +792,7 @@ class Screen: last_x, last_y = self._last_mouse_position dx, dy = x - last_x, y - last_y if self._is_summary_focused: - self._summary.mouse_scroll(dx, dy) + self._summary.scroll(dx, dy) else: self._move_listing((-dx, -dy)) else: # Mouse press