[tor-commits] [nyx/master] Scrolling couldn't reach bottom line

atagar at torproject.org atagar at torproject.org
Mon Jul 4 22:27:02 UTC 2016


commit 401ca0b7b82d4aa57d9e2f925b9ee97845e1e7a0
Author: Damian Johnson <atagar at torproject.org>
Date:   Wed Jun 29 09:36:17 2016 -0700

    Scrolling couldn't reach bottom line
    
    Our scrolling didn't account for the panel's title line, causing an off-by-one
    error.
---
 nyx/panel/log.py   | 4 ++--
 nyx/panel/torrc.py | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/nyx/panel/log.py b/nyx/panel/log.py
index 5c7e60b..f68748a 100644
--- a/nyx/panel/log.py
+++ b/nyx/panel/log.py
@@ -253,7 +253,7 @@ class LogPanel(nyx.panel.DaemonPanel):
     nyx.panel.Panel.set_paused(self, is_pause)
 
   def draw(self, subwindow):
-    scroll = self._scroller.location(self._last_content_height, subwindow.height)
+    scroll = self._scroller.location(self._last_content_height, subwindow.height - 1)
 
     event_log = list(self._event_log_paused if self.is_paused() else self._event_log)
     event_filter = self._filter.clone()
@@ -264,7 +264,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)
+      subwindow.scrollbar(1, scroll, last_content_height - 1)
 
     x, y = 3 if is_scrollbar_visible else 1, 1 - scroll
 
diff --git a/nyx/panel/torrc.py b/nyx/panel/torrc.py
index b279ea0..20b403d 100644
--- a/nyx/panel/torrc.py
+++ b/nyx/panel/torrc.py
@@ -104,7 +104,7 @@ class TorrcPanel(panel.Panel):
     )
 
   def draw(self, width, height):
-    scroll = self._scroller.location(self._last_content_height, height)
+    scroll = self._scroller.location(self._last_content_height - 1, height - 1)
 
     if self._torrc_content is None:
       self.addstr(1, 0, self._torrc_load_error, RED, BOLD)
@@ -121,7 +121,7 @@ class TorrcPanel(panel.Panel):
 
       if self._last_content_height > height - 1:
         scroll_offset = 3
-        self.add_scroll_bar(scroll, scroll + height - 1, self._last_content_height, 1)
+        self.add_scroll_bar(scroll, scroll + height - 1, self._last_content_height - 1, 1)
 
       y = 1 - scroll
       is_multiline = False  # true if we're in the middle of a multiline torrc entry





More information about the tor-commits mailing list