on master help sign in
Replace DAP vars popup, instead of adding new (#7034)
commitd5fe08ddb8bf1408a1a92d39a63b51cd16d83255 authorA-Walrus <58790821+A-Walrus@users.noreply.github.com> dateSat 13 May 2023, 18:44 (3 years ago) parent06d7f5d
2 files changed+8−1
helix-term/src/commands.rs+7 helix-term/src/commands/dap.rs+1−1
helix-term/src/commands.rs+7
@@ -97,6 +97,13 @@ impl<'a> Context<'a> {
9797 }));
9898 }
9999
100+ /// Call `replace_or_push` on the Compositor
101+ pub fn replace_or_push_layer<T: Component>(&mut self, id: &'static str, component: T) {
102+ self.callback = Some(Box::new(move |compositor: &mut Compositor, _| {
103+ compositor.replace_or_push(id, component);
104+ }));
105+ }
106+
100107 #[inline]
101108 pub fn on_next_key(
102109 &mut self,
helix-term/src/commands/dap.rs+1−1
@@ -580,7 +580,7 @@ pub fn dap_variables(cx: &mut Context) {
580580
581581 let contents = Text::from(tui::text::Text::from(variables));
582582 let popup = Popup::new("dap-variables", contents);
583− cx.push_layer(Box::new(popup));
583+ cx.replace_or_push_layer("dap-variables", popup);
584584}
585585
586586pub fn dap_terminate(cx: &mut Context) {