diff --git a/docs/dd_editor_component.md b/docs/dd_editor_component.md index 664b0845e..4679b79a0 100644 --- a/docs/dd_editor_component.md +++ b/docs/dd_editor_component.md @@ -159,7 +159,7 @@ impl EditorEngine { } pub struct EditorBuffer { - // TODO + } ``` diff --git a/tuify/src/event_loop.rs b/tuify/src/event_loop.rs index a0ffb8e34..eb2376516 100644 --- a/tuify/src/event_loop.rs +++ b/tuify/src/event_loop.rs @@ -31,7 +31,6 @@ pub enum EventLoopResult { Select, } -// TODO: add performance using output buffer pub fn enter_event_loop( state: &mut S, function_component: &mut impl FunctionComponent, @@ -41,15 +40,15 @@ pub fn enter_event_loop( enable_raw_mode()?; // Use to handle clean up. - #[allow(unused_assignments)] - let mut maybe_return_this: Option = None; + let return_this: EventLoopResult; // First render before blocking the main thread for user input. function_component.render(state)?; loop { let key_event = read_key_press(); - match on_keypress(state, key_event) { + let it = on_keypress(state, key_event); + match it { EventLoopResult::ContinueAndRerenderAndClear => { // Clear the viewport. function_component.clear_viewport_for_resize(state)?; @@ -65,18 +64,18 @@ pub fn enter_event_loop( } EventLoopResult::ExitWithResult(it) => { // Break the loop and return the result. - maybe_return_this = Some(EventLoopResult::ExitWithResult(it)); + return_this = EventLoopResult::ExitWithResult(it); function_component.clear_viewport(state)?; break; } EventLoopResult::ExitWithoutResult => { // Break the loop and return the result. - maybe_return_this = Some(EventLoopResult::ExitWithoutResult); + return_this = EventLoopResult::ExitWithoutResult; function_component.clear_viewport(state)?; break; } EventLoopResult::ExitWithError => { - maybe_return_this = Some(EventLoopResult::ExitWithError); + return_this = EventLoopResult::ExitWithError; function_component.clear_viewport(state)?; break; } @@ -84,12 +83,7 @@ pub fn enter_event_loop( } // Perform cleanup of raw mode, and show cursor. - match maybe_return_this { - Some(it) => { - execute!(function_component.get_write(), Show)?; - disable_raw_mode()?; - Ok(it) - } - None => Ok(EventLoopResult::ExitWithoutResult), - } + execute!(function_component.get_write(), Show)?; + disable_raw_mode()?; + Ok(return_this) } diff --git a/tuify/src/giti/branch/mod.rs b/tuify/src/giti/branch/mod.rs index 1e887bca4..8334163ad 100644 --- a/tuify/src/giti/branch/mod.rs +++ b/tuify/src/giti/branch/mod.rs @@ -1,2 +1,2 @@ pub mod delete; -pub use delete::*; \ No newline at end of file +pub use delete::*; diff --git a/tuify/src/giti/mod.rs b/tuify/src/giti/mod.rs index 24df05339..6cfc6cfc9 100644 --- a/tuify/src/giti/mod.rs +++ b/tuify/src/giti/mod.rs @@ -1,2 +1,2 @@ pub mod branch; -pub use branch::*; \ No newline at end of file +pub use branch::*;