diff options
author | ClementTsang <cjhtsang@uwaterloo.ca> | 2020-02-02 14:24:10 -0500 |
---|---|---|
committer | ClementTsang <cjhtsang@uwaterloo.ca> | 2020-02-02 14:24:10 -0500 |
commit | 96bb4d1dc13a851b76738290c137a5322a5fde79 (patch) | |
tree | 1eecbf21ca57d1e6db48b1be324f5a201474363d /src | |
parent | 1b09133e3b5a9fed927dcc56851e5ac7cdcc0eb5 (diff) |
Fix too small window bug
Diffstat (limited to 'src')
-rw-r--r-- | src/canvas.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/canvas.rs b/src/canvas.rs index 05e7186e..0e28255e 100644 --- a/src/canvas.rs +++ b/src/canvas.rs @@ -741,7 +741,7 @@ fn draw_temp_table<B: backend::Backend>( ) { let temp_sensor_data: &[Vec<String>] = &(app_state.canvas_data.temp_sensor_data); - let num_rows = u64::from(draw_loc.height) - 5; + let num_rows = max(0, i64::from(draw_loc.height) - 5) as u64; let start_position = get_start_position( num_rows, &(app_state.scroll_direction), @@ -807,7 +807,7 @@ fn draw_disk_table<B: backend::Backend>( f: &mut Frame<B>, app_state: &mut app::App, draw_loc: Rect, ) { let disk_data: &[Vec<String>] = &(app_state.canvas_data.disk_data); - let num_rows = u64::from(draw_loc.height) - 5; + let num_rows = max(0, i64::from(draw_loc.height) - 5) as u64; let start_position = get_start_position( num_rows, &(app_state.scroll_direction), @@ -958,7 +958,7 @@ fn draw_processes_table<B: backend::Backend>( // hit the process we've currently scrolled to. // We also need to move the list - we can // do so by hiding some elements! - let num_rows = u64::from(draw_loc.height) - 5; + let num_rows = max(0, i64::from(draw_loc.height) - 5) as u64; let position = get_start_position( num_rows, |