commit 26e40be0b4ad080535e5685eb7643d88b26202ca Author: Damian Johnson atagar@torproject.org Date: Wed Mar 14 12:51:41 2018 -0700
Max recursion depth error when resizing terminal
When squishing the terminal I can occasionally trigger a maximum recursion loop...
Traceback (most recent call last): ... File "/home/atagar/Desktop/nyx/nyx/panel/log.py", line 326, in _draw self.redraw() File "/home/atagar/Desktop/nyx/nyx/panel/__init__.py", line 175, in redraw self._last_draw_size = nyx.curses.draw(self._draw, top = self._top, height = self.get_height(), draw_if_resized = draw_dimension) File "/home/atagar/Desktop/nyx/nyx/curses.py", line 746, in draw func(_Subwindow(subwindow_width, subwindow_height, curses_subwindow)) File "/home/atagar/Desktop/nyx/nyx/panel/log.py", line 326, in _draw self.redraw() RuntimeError: maximum recursion depth exceeded in cmp
Adjustments made by the log panel within its draw function *should* prevent a need to iterate a second time, but evidently that's not always the case. Simply adjusting how we iterate to prevent a forced redraw from triggering another forced redraw. --- nyx/panel/log.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/nyx/panel/log.py b/nyx/panel/log.py index 18c247c..3f20c4b 100644 --- a/nyx/panel/log.py +++ b/nyx/panel/log.py @@ -275,7 +275,7 @@ class LogPanel(nyx.panel.DaemonPanel): ]), ])
- def _draw(self, subwindow): + def _draw(self, subwindow, is_correction = False): scroll = self._scroller.location(self._last_content_height, subwindow.height - 1)
event_filter = self._filter.clone() @@ -321,9 +321,9 @@ class LogPanel(nyx.panel.DaemonPanel): self._last_content_height = new_content_height self._has_new_event = False
- if force_redraw: + if force_redraw and not is_correction: log.debug('redrawing the log panel with the corrected content height (%s)' % force_redraw_reason) - self.redraw() + self._draw(subwindow, True)
def _update(self): """
tor-commits@lists.torproject.org