[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [nyx/master] Integer division for scrollbars



commit c900957ef05ca900643e55fdc57855bb90b07190
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Tue Nov 15 10:37:24 2016 -0800

    Integer division for scrollbars
    
    Odd, tests fail on my netbook but pass on my pc. Not quite sure yet what's up
    but one clear issue is that we use standard rather than integer division. This
    differs between python 2.x and 3.x (the later results in a float) so
    normalizing us on ints.
---
 nyx/curses.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/nyx/curses.py b/nyx/curses.py
index f25839e..78eb14e 100644
--- a/nyx/curses.py
+++ b/nyx/curses.py
@@ -34,6 +34,7 @@ if we want Windows support in the future too.
     |- addstr - draws a string
     |- addstr_wrap - draws a string with line wrapping
     |- box - draws box with the given dimensions
+    |- scrollbar - draws a left-hand scrollbar
     |- hline - draws a horizontal line
     +- vline - draws a vertical line
 
@@ -885,8 +886,8 @@ class _Subwindow(object):
 
     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
+    slider_top = scrollbar_height * top_index // size
+    slider_size = scrollbar_height * (bottom_index - top_index) // size
     max_slider_top = scrollbar_height - slider_size - 1
 
     # ensures slider isn't at top or bottom unless really at those extreme bounds



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits