aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/compositor.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src/compositor.rs')
-rw-r--r--helix-term/src/compositor.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/helix-term/src/compositor.rs b/helix-term/src/compositor.rs
index 61a3bfaf..5548e832 100644
--- a/helix-term/src/compositor.rs
+++ b/helix-term/src/compositor.rs
@@ -150,6 +150,14 @@ impl Compositor {
self.layers.pop()
}
+ pub fn remove(&mut self, id: &'static str) -> Option<Box<dyn Component>> {
+ let idx = self
+ .layers
+ .iter()
+ .position(|layer| layer.id() == Some(id))?;
+ Some(self.layers.remove(idx))
+ }
+
pub fn handle_event(&mut self, event: Event, cx: &mut Context) -> bool {
// If it is a key event and a macro is being recorded, push the key event to the recording.
if let (Event::Key(key), Some((_, keys))) = (event, &mut cx.editor.macro_recording) {