[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [nyx/master] Voluminous content slowed interpreter panel
commit 6492a3a1676b3795d9179ff875fb879fe1383688
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Thu Jan 3 14:40:25 2019 -0800
Voluminous content slowed interpreter panel
Each refresh of our interpreter panel iterated over every line of its content,
regardless of if it was visible or not. This is silly. Limiting the range the
draw function consults to only what's visible.
Caught thanks to wagon...
https://trac.torproject.org/projects/tor/ticket/28902
---
nyx/panel/interpreter.py | 14 +++++++++-----
web/changelog/index.html | 6 ++++++
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/nyx/panel/interpreter.py b/nyx/panel/interpreter.py
index aa57d29..0a4209d 100644
--- a/nyx/panel/interpreter.py
+++ b/nyx/panel/interpreter.py
@@ -130,9 +130,13 @@ class InterpreterPanel(nyx.panel.Panel):
self._x_offset = 2
subwindow.scrollbar(1, scroll, len(self._lines) + 1)
- for i, line in enumerate(self._lines + [prompt]):
- x, y = self._x_offset, i + 1 - scroll
+ visible_lines = self._lines[scroll:scroll + subwindow.height - 1]
- if y > 0:
- for text, attr in line:
- x = subwindow.addstr(x, y, text, *attr)
+ if len(visible_lines) < subwindow.height - 1:
+ visible_lines.append(prompt)
+
+ for y, line in enumerate(visible_lines):
+ x = self._x_offset
+
+ for text, attr in line:
+ x = subwindow.addstr(x, y + 1, text, *attr)
diff --git a/web/changelog/index.html b/web/changelog/index.html
index 0bbc01a..8041655 100644
--- a/web/changelog/index.html
+++ b/web/changelog/index.html
@@ -112,6 +112,12 @@
</ul>
</li>
+ <li><span class="component">Interpreter</span>
+ <ul>
+ <li>Large amounts of content made panel sluggish (<b><a href="https://trac.torproject.org/projects/tor/ticket/28902">ticket</a></b>)</li>
+ </ul>
+ </li>
+
<li><span class="component">Curses</span>
<ul>
<li>Resizing could crash the interface (<b><a href="https://trac.torproject.org/projects/tor/ticket/24382">ticket</a></b>)</li>
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits