aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--helix-term/src/commands.rs7
-rw-r--r--helix-term/src/commands/dap.rs2
2 files changed, 8 insertions, 1 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 882a8a1d..7d86bc0b 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -97,6 +97,13 @@ impl<'a> Context<'a> {
}));
}
+ /// Call `replace_or_push` on the Compositor
+ pub fn replace_or_push_layer<T: Component>(&mut self, id: &'static str, component: T) {
+ self.callback = Some(Box::new(move |compositor: &mut Compositor, _| {
+ compositor.replace_or_push(id, component);
+ }));
+ }
+
#[inline]
pub fn on_next_key(
&mut self,
diff --git a/helix-term/src/commands/dap.rs b/helix-term/src/commands/dap.rs
index 8efdc9cf..84794bed 100644
--- a/helix-term/src/commands/dap.rs
+++ b/helix-term/src/commands/dap.rs
@@ -580,7 +580,7 @@ pub fn dap_variables(cx: &mut Context) {
let contents = Text::from(tui::text::Text::from(variables));
let popup = Popup::new("dap-variables", contents);
- cx.push_layer(Box::new(popup));
+ cx.replace_or_push_layer("dap-variables", popup);
}
pub fn dap_terminate(cx: &mut Context) {