diff --git a/Cargo.lock b/Cargo.lock index 31f14e8be..615baa841 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -280,7 +280,7 @@ dependencies = [ [[package]] name = "console-subscriber" -version = "0.1.7" +version = "0.1.8" dependencies = [ "console-api", "crossbeam-channel", diff --git a/tokio-console/src/view/mod.rs b/tokio-console/src/view/mod.rs index e22d239af..8f1d5429d 100644 --- a/tokio-console/src/view/mod.rs +++ b/tokio-console/src/view/mod.rs @@ -96,6 +96,17 @@ impl View { pub(crate) fn update_input(&mut self, event: input::Event, state: &State) -> UpdateKind { use ViewState::*; let mut update_kind = UpdateKind::Other; + + if matches!(event, key!(Char('t'))) { + self.state = TasksList; + return update_kind; + } + + if matches!(event, key!(Char('r'))) { + self.state = ResourcesList; + return update_kind; + } + match self.state { TasksList => { // The enter key changes views, so handle here since we can @@ -110,9 +121,6 @@ impl View { )); } } - key!(Char('r')) => { - self.state = ResourcesList; - } _ => { // otherwise pass on to view self.tasks_list.update_input(event); @@ -127,9 +135,6 @@ impl View { self.state = ResourceInstance(self::resource::ResourceView::new(res)); } } - key!(Char('t')) => { - self.state = TasksList; - } _ => { // otherwise pass on to view self.resources_list.update_input(event);