Specifically when -w/--watch is specified, and the terminal is narrowed to the point where the header takes up more than one line, and there are more visible processes than are lines available on the screen, only the bottommost header line is displayed (at least on the terminal emulator "Terminal" on Debian). This is because the number of visible processes scrolls the view window and cuts off upper lines (I discovered this by using tmux's scrollback buffer to investigate what was above the confines of the regular screen). Such behavior can be seen with the output of procs -w on a 24x80 terminal:
This off-by-one error also causes the scrollback to get polluted with duplicate header lines, although this is simply annoying rather than detrimental (again running procs -w, just scrolling up a few lines):
This PR changes Watcher::display_header to return Result<usize, Error> where the Ok variant has the number of lines the header takes up, so that the the (new) header_lines parameter of View::filter can be populated. It also changes View::filter to break a bit earlier according to how many lines were taken up by the header, so as to prevent the two behaviors identified above.
Specifically when -w/--watch is specified, and the terminal is narrowed to the point where the header takes up more than one line, and there are more visible processes than are lines available on the screen, only the bottommost header line is displayed (at least on the terminal emulator "Terminal" on Debian). This is because the number of visible processes scrolls the view window and cuts off upper lines (I discovered this by using tmux's scrollback buffer to investigate what was above the confines of the regular screen). Such behavior can be seen with the output of
procs -w
on a 24x80 terminal: This off-by-one error also causes the scrollback to get polluted with duplicate header lines, although this is simply annoying rather than detrimental (again runningprocs -w
, just scrolling up a few lines): This PR changesWatcher::display_header
to returnResult<usize, Error>
where theOk
variant has the number of lines the header takes up, so that the the (new)header_lines
parameter ofView::filter
can be populated. It also changesView::filter
to break a bit earlier according to how many lines were taken up by the header, so as to prevent the two behaviors identified above.