[tor-commits] [nyx/master] Make room for IPv6 addresses on the connection panel

atagar at torproject.org atagar at torproject.org
Fri Nov 3 19:00:03 UTC 2017


commit db0800083b370aedda8ed6dbebcc38247e65dec7
Author: Damian Johnson <atagar at torproject.org>
Date:   Fri Nov 3 11:52:29 2017 -0700

    Make room for IPv6 addresses on the connection panel
    
    Great catch from Hello71 that when a relay has IPv6 addresses the columns
    overwrite each other. These addresses are long enough that they crowd out the
    other fields, but them's the breaks. Shifting the other fields to make room.
    
    For IPv4 alignment should be unchanged.
---
 nyx/panel/connection.py | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/nyx/panel/connection.py b/nyx/panel/connection.py
index f4d7df6..35fe511 100644
--- a/nyx/panel/connection.py
+++ b/nyx/panel/connection.py
@@ -608,9 +608,9 @@ def _draw_line(subwindow, x, y, line, is_selected, width, current_time):
   else:
     x += 1  # offset from edge
 
-  _draw_address_column(subwindow, x, y, line, attr)
-  _draw_line_details(subwindow, 57, y, line, width - 57 - 20, attr)
-  _draw_right_column(subwindow, width - 18, y, line, current_time, attr)
+  x = _draw_address_column(subwindow, x, y, line, attr)
+  x = _draw_line_details(subwindow, x + 2, y, line, width - 57 - 20, attr)
+  _draw_right_column(subwindow, max(x, width - 18), y, line, current_time, attr)
 
 
 def _draw_address_column(subwindow, x, y, line, attr):
@@ -637,9 +637,9 @@ def _draw_address_column(subwindow, x, y, line, attr):
     dst, src = src, dst
 
   if line.line_type == LineType.CIRCUIT:
-    subwindow.addstr(x, y, dst, *attr)
+    return subwindow.addstr(x, y, dst, *attr)
   else:
-    subwindow.addstr(x, y, '%-21s  -->  %-26s' % (src, dst), *attr)
+    return subwindow.addstr(x, y, '%-21s  -->  %-26s' % (src, dst), *attr)
 
 
 def _draw_details(subwindow, selected):
@@ -718,7 +718,9 @@ def _draw_line_details(subwindow, x, y, line, width, attr):
     if width >= len(entry):
       x = subwindow.addstr(x, y, entry, *attr)
     else:
-      return
+      return x
+
+  return x
 
 
 def _draw_right_column(subwindow, x, y, line, current_time, attr):



More information about the tor-commits mailing list