diff options
author | Paul Wise <pabs3@bonedaddy.net> | 2016-08-04 17:28:57 +0800 |
---|---|---|
committer | Paul Wise <pabs3@bonedaddy.net> | 2016-08-04 17:29:39 +0800 |
commit | 2afaaf25690cb5eb8cb527be0de030d3c796e991 (patch) | |
tree | e93f41af7e3ab4abbe89dfae61438d4671297caf | |
parent | c8cc7ef97be1bd8854eb9c5c627e61cc0752674f (diff) | |
download | iotop-2afaaf25690cb5eb8cb527be0de030d3c796e991.tar.gz |
Print the titles at specific locations
Prevents a crash in a 3-line terminal:
Traceback (most recent call last):
File "./iotop.py", line 12, in <module>
main()
File "./iotop/ui.py", line 652, in main
main_loop()
File "./iotop/ui.py", line 642, in <lambda>
main_loop = lambda: run_iotop(options)
File "./iotop/ui.py", line 537, in run_iotop
return curses.wrapper(run_iotop_window, options)
File "/usr/lib/python2.7/curses/wrapper.py", line 43, in wrapper
return func(stdscr, *args, **kwds)
File "./iotop/ui.py", line 529, in run_iotop_window
ui.run()
File "./iotop/ui.py", line 176, in run
self.process_list.duration)
File "./iotop/ui.py", line 492, in refresh_display
self.win.addstr(title, attr)
_curses.error: addstr() returned ERR
-rw-r--r-- | iotop/ui.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/iotop/ui.py b/iotop/ui.py index 44cfc34..d43f279 100644 --- a/iotop/ui.py +++ b/iotop/ui.py @@ -478,6 +478,7 @@ class IOTopUI(object): self.win.addstr(i, 0, s[:self.width]) self.win.hline(len(summary), 0, ord(' ') | curses.A_REVERSE, self.width) + pos = 0 remaining_cols = self.width for i in range(len(titles)): attr = curses.A_REVERSE @@ -489,7 +490,8 @@ class IOTopUI(object): title += self.sorting_reverse and '>' or '<' title = title[:remaining_cols] remaining_cols -= len(title) - self.win.addstr(title, attr) + self.win.addstr(len(summary), pos, title, attr) + pos += len(title) if Stats.has_blkio_delay_total: status_msg = None else: |