summaryrefslogtreecommitdiffstats
path: root/src/edit/mod.rs
diff options
context:
space:
mode:
authorTim Oram <dev@mitmaro.ca>2020-09-17 10:45:49 -0230
committerTim Oram <dev@mitmaro.ca>2020-09-17 22:01:14 -0230
commitc6dbcc6017a7a1b343a585729239ad52ccb6ceba (patch)
tree5f27828bc435ef9eed85ebd835d55418985c07cb /src/edit/mod.rs
parent10d797ebf3910f45f6ed3cd01573e531f388f31d (diff)
Move error handling to process module
The error handling module needed to have state provided to it from other modules, which meant that the other modules needed to understand how the error module worked. This was awkward and fragile. This moves the error handling code into the process module and makes it a global system. This has the advantage of not requiring tracking of the previous state and allows for the removal of the HandleInputResult struct.
Diffstat (limited to 'src/edit/mod.rs')
-rw-r--r--src/edit/mod.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/edit/mod.rs b/src/edit/mod.rs
index 9ac45c6..9b28fc3 100644
--- a/src/edit/mod.rs
+++ b/src/edit/mod.rs
@@ -2,8 +2,8 @@ use crate::display::display_color::DisplayColor;
use crate::git_interactive::GitInteractive;
use crate::input::input_handler::{InputHandler, InputMode};
use crate::input::Input;
-use crate::process::handle_input_result::{HandleInputResult, HandleInputResultBuilder};
use crate::process::process_module::ProcessModule;
+use crate::process::process_result::ProcessResult;
use crate::process::state::State;
use crate::view::line_segment::LineSegment;
use crate::view::view_data::ViewData;
@@ -72,11 +72,11 @@ impl ProcessModule for Edit {
input_handler: &InputHandler<'_>,
git_interactive: &mut GitInteractive,
view: &View<'_>,
- ) -> HandleInputResult
+ ) -> ProcessResult
{
let result = loop {
let input = input_handler.get_input(InputMode::Raw);
- let result = HandleInputResultBuilder::new(input);
+ let result = ProcessResult::new().input(input);
match input {
Input::Character(c) => {
let start = UnicodeSegmentation::graphemes(self.content.as_str(), true)
@@ -137,7 +137,7 @@ impl ProcessModule for Edit {
}
break result;
};
- result.build()
+ result
}
}