Commit 82a657f7a0
Unsigned
Layout: unified · split
src/global/functions/key_input.rs +18 −18
| @@ -16,24 +16,6 @@ pub fn key_input( | ||
| 16 | 16 | framework: &mut Framework, |
| 17 | 17 | terminal: &mut Terminal<CrosstermBackend<Stdout>>, |
| 18 | 18 | ) { |
| 19 | // check if key binds to any commands | |
| 20 | let command_to_run = framework | |
| 21 | .data | |
| 22 | .global | |
| 23 | .get::<CommandBindings>() | |
| 24 | .unwrap() | |
| 25 | .get_command(&key, framework.data.state.get::<Page>().unwrap()); | |
| 26 | if !command_to_run.is_empty() { | |
| 27 | run_command(&apply_envs(command_to_run), framework, terminal); | |
| 28 | framework | |
| 29 | .data | |
| 30 | .state | |
| 31 | .get_mut::<Tasks>() | |
| 32 | .unwrap() | |
| 33 | .priority | |
| 34 | .push(Task::RenderAll); | |
| 35 | } | |
| 36 | ||
| 37 | 19 | // 1. get the corresponding action |
| 38 | 20 | // 2. check if action is deselect, if yes, deselect |
| 39 | 21 | // 3. check is anything is selected, if yes, run `.key_event()` with the key |
| @@ -108,6 +90,24 @@ pub fn key_input( | ||
| 108 | 90 | } |
| 109 | 91 | } |
| 110 | 92 | |
| 93 | // check if key binds to any commands | |
| 94 | let command_to_run = framework | |
| 95 | .data | |
| 96 | .global | |
| 97 | .get::<CommandBindings>() | |
| 98 | .unwrap() | |
| 99 | .get_command(&key, framework.data.state.get::<Page>().unwrap()); | |
| 100 | if !command_to_run.is_empty() { | |
| 101 | run_command(&apply_envs(command_to_run), framework, terminal); | |
| 102 | framework | |
| 103 | .data | |
| 104 | .state | |
| 105 | .get_mut::<Tasks>() | |
| 106 | .unwrap() | |
| 107 | .priority | |
| 108 | .push(Task::RenderAll); | |
| 109 | } | |
| 110 | ||
| 111 | 111 | if let Some(action) = action { |
| 112 | 112 | let mut render = true; |
| 113 | 113 | match action { |