aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/compositor.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2020-12-07 06:18:37 +0000
committerBlaž Hrastnik2020-12-07 06:18:37 +0000
commitbe3c02104600e5bba8e3af7bc9787e62cba30183 (patch)
treeea979af870ca97df2cca0043a9df5c22f5f1880e /helix-term/src/compositor.rs
parent83f2c24115cc5a3dce90a77440f1ef06f6cf9c78 (diff)
snapshot
Diffstat (limited to 'helix-term/src/compositor.rs')
-rw-r--r--helix-term/src/compositor.rs10
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.