diff options
author | ClementTsang <clementjhtsang@gmail.com> | 2020-01-01 18:39:59 -0500 |
---|---|---|
committer | ClementTsang <clementjhtsang@gmail.com> | 2020-01-01 18:39:59 -0500 |
commit | 7208908413c49deccefa2c2de2272407b6278b02 (patch) | |
tree | cf44ed618e94dc1c3d42c1c0f3e62eab2b59c6d3 | |
parent | 11a6d25d4af697bb4bb567dbae33bfe299b8ea44 (diff) |
[skip travis] Add check to prevent improper dd while on another panel
-rw-r--r-- | src/app.rs | 20 | ||||
-rw-r--r-- | src/app/process_killer.rs | 2 |
2 files changed, 12 insertions, 10 deletions
@@ -116,13 +116,15 @@ impl App { match caught_char { 'd' => { - if self.awaiting_second_char && self.second_char == 'd' { - self.awaiting_second_char = false; - self.second_char = ' '; - self.kill_highlighted_process().unwrap_or(()); // TODO: Return error to user? We have a dialog box... - } else { - self.awaiting_second_char = true; - self.second_char = 'd'; + if let ApplicationPosition::Process = self.current_application_position { + if self.awaiting_second_char && self.second_char == 'd' { + self.awaiting_second_char = false; + self.second_char = ' '; + self.kill_highlighted_process().unwrap_or(()); // TODO: Return error to user? We have a dialog box... + } else { + self.awaiting_second_char = true; + self.second_char = 'd'; + } } } 'g' => { @@ -278,7 +280,7 @@ impl App { ApplicationPosition::Process => self.change_process_position(-1), ApplicationPosition::Temp => self.change_temp_position(-1), ApplicationPosition::Disk => self.change_disk_position(-1), - ApplicationPosition::Cpu => self.change_cpu_table_position(-1), // TODO: Temporary + ApplicationPosition::Cpu => self.change_cpu_table_position(-1), // TODO: Temporary, may change if we add scaling _ => {} } self.scroll_direction = ScrollDirection::UP; @@ -290,7 +292,7 @@ impl App { ApplicationPosition::Process => self.change_process_position(1), ApplicationPosition::Temp => self.change_temp_position(1), ApplicationPosition::Disk => self.change_disk_position(1), - ApplicationPosition::Cpu => self.change_cpu_table_position(1), // TODO: Temporary + ApplicationPosition::Cpu => self.change_cpu_table_position(1), // TODO: Temporary, may change if we add scaling _ => {} } self.scroll_direction = ScrollDirection::DOWN; diff --git a/src/app/process_killer.rs b/src/app/process_killer.rs index 160139b2..b6793f39 100644 --- a/src/app/process_killer.rs +++ b/src/app/process_killer.rs @@ -1,7 +1,7 @@ /// This file is meant to house (OS specific) implementations on how to kill processes. use std::process::Command; -// TODO: Redo this, also make it update process list on freeze. +// TODO: Make it update process list on freeze. // Copied from SO: https://stackoverflow.com/a/55231715 #[cfg(target_os = "windows")] |