diff options
author | Blaž Hrastnik | 2020-12-07 06:18:37 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2020-12-07 06:18:37 +0000 |
commit | be3c02104600e5bba8e3af7bc9787e62cba30183 (patch) | |
tree | ea979af870ca97df2cca0043a9df5c22f5f1880e /helix-term/src/compositor.rs | |
parent | 83f2c24115cc5a3dce90a77440f1ef06f6cf9c78 (diff) |
snapshot
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. |