on master help sign in
Replace DAP vars popup, instead of adding new (#7034)
d5fe08dA-Walrus
helix-term/src/commands.rs+7
@@ -97,6 +97,13 @@ impl<'a> Context<'a> {
97 }));
97 }));
98 }
98 }
99
99
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+
100 #[inline]
107 #[inline]
101 pub fn on_next_key(
108 pub fn on_next_key(
102 &mut self,
109 &mut self,
helix-term/src/commands/dap.rs+1−1
@@ -580,7 +580,7 @@ pub fn dap_variables(cx: &mut Context) {
580
580
581 let contents = Text::from(tui::text::Text::from(variables));
581 let contents = Text::from(tui::text::Text::from(variables));
582 let popup = Popup::new("dap-variables", contents);
582 let popup = Popup::new("dap-variables", contents);
583− cx.push_layer(Box::new(popup));
583+ cx.replace_or_push_layer("dap-variables", popup);
584}
584}
585
585
586pub fn dap_terminate(cx: &mut Context) {
586pub fn dap_terminate(cx: &mut Context) {