debugger: Align zoom behavior with other panels (#31901)

Release Notes:

- Debugger Beta: `shift-escape` (`workspace::ToggleZoom`) now zooms the
entire debug panel; `alt-shift-escape` (`debugger::ToggleExpandItem`)
triggers the old behavior of zooming a specific item.
This commit is contained in:
Cole Miller 2025-06-02 20:59:36 -04:00 committed by GitHub
parent 63c1033448
commit 6f97da3435
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 69 additions and 21 deletions

View file

@ -311,6 +311,7 @@ pub struct Pane {
>,
can_split_predicate:
Option<Arc<dyn Fn(&mut Self, &dyn Any, &mut Window, &mut Context<Self>) -> bool>>,
can_toggle_zoom: bool,
should_display_tab_bar: Rc<dyn Fn(&Window, &mut Context<Pane>) -> bool>,
render_tab_bar_buttons: Rc<
dyn Fn(
@ -450,6 +451,7 @@ impl Pane {
can_drop_predicate,
custom_drop_handle: None,
can_split_predicate: None,
can_toggle_zoom: true,
should_display_tab_bar: Rc::new(|_, cx| TabBarSettings::get_global(cx).show),
render_tab_bar_buttons: Rc::new(default_render_tab_bar_buttons),
render_tab_bar: Rc::new(Self::render_tab_bar),
@ -650,6 +652,11 @@ impl Pane {
self.can_split_predicate = can_split_predicate;
}
pub fn set_can_toggle_zoom(&mut self, can_toggle_zoom: bool, cx: &mut Context<Self>) {
self.can_toggle_zoom = can_toggle_zoom;
cx.notify();
}
pub fn set_close_pane_if_empty(&mut self, close_pane_if_empty: bool, cx: &mut Context<Self>) {
self.close_pane_if_empty = close_pane_if_empty;
cx.notify();
@ -1104,7 +1111,9 @@ impl Pane {
}
pub fn toggle_zoom(&mut self, _: &ToggleZoom, window: &mut Window, cx: &mut Context<Self>) {
if self.zoomed {
if !self.can_toggle_zoom {
cx.propagate();
} else if self.zoomed {
cx.emit(Event::ZoomOut);
} else if !self.items.is_empty() {
if !self.focus_handle.contains_focused(window, cx) {