diff options
author | Tim Oram <dev@mitmaro.ca> | 2020-03-16 19:51:26 -0230 |
---|---|---|
committer | Tim Oram <dev@mitmaro.ca> | 2020-03-17 11:41:50 -0230 |
commit | 86748030dc0eb7284a0206192669d79ec6d7895e (patch) | |
tree | 8a2ac08179e9004c4667cac2d85818f22280408e /src/external_editor/mod.rs | |
parent | 22374c2393c1007cc068fbec64103c59b1fa04da (diff) |
Refactor input handling
This change adds a input mode to provide context aware input processing.
This removes a consistent interface to the input handling for the raw
text input and confirm dialog inputs. It also removes the unneeded
matching on list view only key bindings from views such as help and show
commit.
Diffstat (limited to 'src/external_editor/mod.rs')
-rw-r--r-- | src/external_editor/mod.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/external_editor/mod.rs b/src/external_editor/mod.rs index 1099fde..b8ac2d8 100644 --- a/src/external_editor/mod.rs +++ b/src/external_editor/mod.rs @@ -4,7 +4,7 @@ use crate::config::Config; use crate::display::Display; use crate::external_editor::argument_tolkenizer::tolkenize; use crate::git_interactive::GitInteractive; -use crate::input::input_handler::InputHandler; +use crate::input::input_handler::{InputHandler, InputMode}; use crate::input::Input; use crate::process::exit_status::ExitStatus; use crate::process::handle_input_result::{HandleInputResult, HandleInputResultBuilder}; @@ -158,7 +158,7 @@ impl<'e> ExternalEditor<'e> { } fn handle_input_active(&self, input_handler: &InputHandler) -> HandleInputResult { - let input = input_handler.get_input(); + let input = input_handler.get_input(InputMode::Default); let mut result = HandleInputResultBuilder::new(input); match input { Input::Resize => {}, @@ -170,7 +170,7 @@ impl<'e> ExternalEditor<'e> { } fn handle_input_empty(&mut self, input_handler: &InputHandler) -> HandleInputResult { - let input = input_handler.get_confirm(); + let input = input_handler.get_input(InputMode::Confirm); let mut result = HandleInputResultBuilder::new(input); match input { Input::Yes => { |