diff --git a/glances/outputs/glances_curses.py b/glances/outputs/glances_curses.py index 2afc9151..bc8cdc57 100644 --- a/glances/outputs/glances_curses.py +++ b/glances/outputs/glances_curses.py @@ -1059,8 +1059,7 @@ class _GlancesCurses(object): if not display_additional and m['additional']: continue # Is it possible to display the stat with the current screen size - # !!! Crash if not try/except... Why ??? - try: + if screen_x - x > 0: self.term_window.addnstr( y, x, @@ -1069,21 +1068,18 @@ class _GlancesCurses(object): screen_x - x, self.colors_list[m['decoration']], ) - except Exception: + # New column + # Python 2: we need to decode to get real screen size because + # UTF-8 special tree chars occupy several bytes. + # Python 3: strings are strings and bytes are bytes, all is + # good. + try: + x += len(u(m['msg'])) + except UnicodeDecodeError: + # Quick and dirty hack for issue #745 pass - else: - # New column - # Python 2: we need to decode to get real screen size because - # UTF-8 special tree chars occupy several bytes. - # Python 3: strings are strings and bytes are bytes, all is - # good. - try: - x += len(u(m['msg'])) - except UnicodeDecodeError: - # Quick and dirty hack for issue #745 - pass - if x > x_max: - x_max = x + if x > x_max: + x_max = x # Compute the next Glances column/line position self.next_column = max(self.next_column, x_max + self.space_between_column)