[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [nyx/master] Smaller screen resolutions broke rendering config panel
commit 44e8b421a913400632504b72ee44bd73cf15dd18
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Sat Jun 3 10:47:51 2017 -0700
Smaller screen resolutions broke rendering config panel
Oops! We need to be careful never to allow crop sizes to be negative. Seems the
following code has size checks so hopefully this is the only spot...
Traceback (most recent call last):
File "/usr/local/bin/nyx", line 14, in <module>
nyx.main()
...
File "/usr/local/lib/python2.7/dist-packages/nyx/panel/config.py", line 328, in _draw_selection_details
subwindow.addstr(2, 2, 'Value: %s (%s)' % (selected.value(), str_tools.crop(attr, subwindow.width - len(selected.value()) - 13)), selected_color, BOLD)
File "/usr/local/lib/python2.7/dist-packages/stem/util/str_tools.py", line 203, in crop
raise ValueError("Crop size can't be negative (received %i)" % size)
ValueError: Crop size can't be negative (received -12)
---
nyx/panel/config.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/nyx/panel/config.py b/nyx/panel/config.py
index 726df64..92b8215 100644
--- a/nyx/panel/config.py
+++ b/nyx/panel/config.py
@@ -325,7 +325,7 @@ def _draw_selection_details(subwindow, selected):
subwindow.box(0, 0, subwindow.width, DETAILS_HEIGHT)
subwindow.addstr(2, 1, '%s (%s Option)' % (selected.name, selected.manual.category), selected_color, BOLD)
- subwindow.addstr(2, 2, 'Value: %s (%s)' % (selected.value(), str_tools.crop(attr, subwindow.width - len(selected.value()) - 13)), selected_color, BOLD)
+ subwindow.addstr(2, 2, 'Value: %s (%s)' % (selected.value(), str_tools.crop(attr, max(0, subwindow.width - len(selected.value()) - 13))), selected_color, BOLD)
description = 'Description: %s' % selected.manual.description
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits