From b5cacb3e2ed993310d9ebd178041e89f5d4fd754 Mon Sep 17 00:00:00 2001 From: ClementTsang Date: Wed, 25 Sep 2019 12:35:32 -0400 Subject: [PATCH] Added arrow key control for processes and the like, and fixed off by one error. --- Cargo.toml | 2 +- src/canvas.rs | 2 +- src/convert_data.rs | 2 +- src/main.rs | 2 ++ 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index fb412211..6d3ac010 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bottom" -version = "0.1.0-alpha.3" +version = "0.1.0-alpha.4" authors = ["Clement Tsang "] edition = "2018" repository = "https://github.com/ClementTsang/bottom" diff --git a/src/canvas.rs b/src/canvas.rs index 7e13dd8f..cb35d723 100644 --- a/src/canvas.rs +++ b/src/canvas.rs @@ -251,7 +251,7 @@ pub fn draw_data(terminal : &mut Terminal, app_state : if app_state.currently_selected_process_position < num_rows { 0 } - else if app_state.currently_selected_process_position - num_rows <= app_state.previous_process_position { + else if app_state.currently_selected_process_position - num_rows < app_state.previous_process_position { app_state.previous_process_position } else { diff --git a/src/convert_data.rs b/src/convert_data.rs index d3bb3147..08a522e3 100644 --- a/src/convert_data.rs +++ b/src/convert_data.rs @@ -5,7 +5,7 @@ pub fn update_temp_row(app_data : &data_collection::Data, temp_type : &data_coll let mut sensor_vector : Vec> = Vec::new(); if (&app_data.list_of_temperature_sensor).is_empty() { - sensor_vector.push(vec!["None Found".to_string(), "".to_string()]) + sensor_vector.push(vec!["No Sensors Found".to_string(), "".to_string()]) } else { for sensor in &app_data.list_of_temperature_sensor { diff --git a/src/main.rs b/src/main.rs index bb1562c0..6872498f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -180,6 +180,8 @@ fn main() -> error::Result<()> { KeyEvent::Char('l') | KeyEvent::Right => app.on_right(), KeyEvent::Char('k') | KeyEvent::Up => app.on_up(), KeyEvent::Char('j') | KeyEvent::Down => app.on_down(), + KeyEvent::ShiftUp => app.decrement_position_count(), + KeyEvent::ShiftDown => app.increment_position_count(), KeyEvent::Char(c) => app.on_key(c), // TODO: We can remove the 'q' event and just move it to the quit? _ => {} }