Added arrow key control for processes and the like, and fixed off by one error.

This commit is contained in:
ClementTsang 2019-09-25 12:35:32 -04:00
parent a592472562
commit b5cacb3e2e
4 changed files with 5 additions and 3 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "bottom"
version = "0.1.0-alpha.3"
version = "0.1.0-alpha.4"
authors = ["Clement Tsang <clementjhtsang@gmail.com>"]
edition = "2018"
repository = "https://github.com/ClementTsang/bottom"

View File

@ -251,7 +251,7 @@ pub fn draw_data<B : backend::Backend>(terminal : &mut Terminal<B>, 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 {

View File

@ -5,7 +5,7 @@ pub fn update_temp_row(app_data : &data_collection::Data, temp_type : &data_coll
let mut sensor_vector : Vec<Vec<String>> = 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 {

View File

@ -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?
_ => {}
}