summaryrefslogtreecommitdiffstats
path: root/src/process/help.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/process/help.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/process/help.rs')
-rw-r--r--src/process/help.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/process/help.rs b/src/process/help.rs
index 304ea4c..4be9cdd 100644
--- a/src/process/help.rs
+++ b/src/process/help.rs
@@ -1,7 +1,7 @@
use crate::display::display_color::DisplayColor;
use crate::input::input_handler::{InputHandler, InputMode};
use crate::input::Input;
-use crate::process::handle_input_result::HandleInputResult;
+use crate::process::process_result::ProcessResult;
use crate::view::line_segment::LineSegment;
use crate::view::view_data::ViewData;
use crate::view::view_line::ViewLine;
@@ -84,7 +84,7 @@ impl Help {
&self.view_data
}
- pub fn handle_input(&mut self, input_handler: &InputHandler<'_>, view: &View<'_>) -> HandleInputResult {
+ pub fn handle_input(&mut self, input_handler: &InputHandler<'_>, view: &View<'_>) -> ProcessResult {
let input = input_handler.get_input(InputMode::Default);
match input {
Input::MoveCursorLeft => self.view_data.scroll_left(),
@@ -97,8 +97,8 @@ impl Help {
let (view_width, view_height) = view.get_view_size();
self.view_data.set_view_size(view_width, view_height);
},
- _ => return HandleInputResult::new(Input::Help),
+ _ => return ProcessResult::new().input(Input::Help),
}
- HandleInputResult::new(input)
+ ProcessResult::new().input(input)
}
}