diff options
Diffstat (limited to 'helix-term/src/compositor.rs')
-rw-r--r-- | helix-term/src/compositor.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/helix-term/src/compositor.rs b/helix-term/src/compositor.rs index 187c5692..f859f947 100644 --- a/helix-term/src/compositor.rs +++ b/helix-term/src/compositor.rs @@ -18,9 +18,17 @@ use crossterm::event::Event; use smol::Executor; use tui::buffer::Buffer as Surface; +pub(crate) type Callback = Box<dyn Fn(&mut Compositor)>; + +// Cursive-inspired +pub(crate) enum EventResult { + Ignored, + Consumed(Option<Callback>), +} + pub(crate) trait Component { /// Process input events, return true if handled. - fn handle_event(&mut self, event: Event, executor: &Executor) -> bool; + fn handle_event(&mut self, event: Event, executor: &Executor) -> EventResult; // , args: () /// Should redraw? Useful for saving redraw cycles if we know component didn't change. |