commit 968d49e9decb35eb7d827e51ac6b259d9e65f249 Author: Damian Johnson atagar@torproject.org Date: Sun Oct 16 15:30:35 2016 -0700
Connection panel scrollbar couldn't reach bottom
Scrolling was fine, but display of the scrollbar was off by one. Ick this math gives me a headache. --- nyx/curses.py | 4 ++-- nyx/panel/config.py | 2 +- nyx/panel/log.py | 2 +- nyx/panel/torrc.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/nyx/curses.py b/nyx/curses.py index 1717067..d610edf 100644 --- a/nyx/curses.py +++ b/nyx/curses.py @@ -838,8 +838,8 @@ class _Subwindow(object):
# determines scrollbar dimensions
- scrollbar_height = self.height - top - 1 - bottom_index = top_index + scrollbar_height + scrollbar_height = self.height - top - 1 # -1 is for the bottom border + bottom_index = top_index + scrollbar_height + 1 slider_top = scrollbar_height * top_index / size slider_size = scrollbar_height * (bottom_index - top_index) / size max_slider_top = scrollbar_height - slider_size - 1 diff --git a/nyx/panel/config.py b/nyx/panel/config.py index 42271e2..3c0cc18 100644 --- a/nyx/panel/config.py +++ b/nyx/panel/config.py @@ -270,7 +270,7 @@ class ConfigPanel(nyx.panel.Panel):
if is_scrollbar_visible: scroll_offset = 3 - subwindow.scrollbar(DETAILS_HEIGHT, scroll, len(contents) - 1) + subwindow.scrollbar(DETAILS_HEIGHT, scroll, len(contents))
if selected is not None: subwindow._addch(1, DETAILS_HEIGHT - 1, curses.ACS_TTEE) diff --git a/nyx/panel/log.py b/nyx/panel/log.py index 468d133..10e2645 100644 --- a/nyx/panel/log.py +++ b/nyx/panel/log.py @@ -274,7 +274,7 @@ class LogPanel(nyx.panel.DaemonPanel): is_scrollbar_visible = last_content_height > subwindow.height - 1
if is_scrollbar_visible: - subwindow.scrollbar(1, scroll, last_content_height - 1) + subwindow.scrollbar(1, scroll, last_content_height)
x, y = 3 if is_scrollbar_visible else 1, 1 - scroll y = _draw_entries(subwindow, x, y, event_log, show_duplicates) diff --git a/nyx/panel/torrc.py b/nyx/panel/torrc.py index eeb08e6..b9e873b 100644 --- a/nyx/panel/torrc.py +++ b/nyx/panel/torrc.py @@ -125,7 +125,7 @@ class TorrcPanel(panel.Panel):
if self._last_content_height > subwindow.height - 1: scroll_offset = 3 - subwindow.scrollbar(1, scroll, self._last_content_height - 1) + subwindow.scrollbar(1, scroll, self._last_content_height)
y = 1 - scroll is_multiline = False # true if we're in the middle of a multiline torrc entry
tor-commits@lists.torproject.org