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

@ -8,6 +8,7 @@ pub mod variable_list;
use std::{any::Any, ops::ControlFlow, path::PathBuf, sync::Arc, time::Duration};
use crate::{
ToggleExpandItem,
new_process_modal::resolve_path,
persistence::{self, DebuggerPaneItem, SerializedLayout},
};
@ -347,6 +348,7 @@ pub(crate) fn new_debugger_pane(
false
}
})));
pane.set_can_toggle_zoom(false, cx);
pane.display_nav_history_buttons(None);
pane.set_custom_drop_handle(cx, custom_drop_handle);
pane.set_should_display_tab_bar(|_, _| true);
@ -472,17 +474,19 @@ pub(crate) fn new_debugger_pane(
},
)
.icon_size(IconSize::XSmall)
.on_click(cx.listener(move |pane, _, window, cx| {
pane.toggle_zoom(&workspace::ToggleZoom, window, cx);
.on_click(cx.listener(move |pane, _, _, cx| {
let is_zoomed = pane.is_zoomed();
pane.set_zoomed(!is_zoomed, cx);
cx.notify();
}))
.tooltip({
let focus_handle = focus_handle.clone();
move |window, cx| {
let zoomed_text =
if zoomed { "Zoom Out" } else { "Zoom In" };
if zoomed { "Minimize" } else { "Expand" };
Tooltip::for_action_in(
zoomed_text,
&workspace::ToggleZoom,
&ToggleExpandItem,
&focus_handle,
window,
cx,
@ -1260,18 +1264,6 @@ impl RunningState {
Event::Focus => {
this.active_pane = source_pane.clone();
}
Event::ZoomIn => {
source_pane.update(cx, |pane, cx| {
pane.set_zoomed(true, cx);
});
cx.notify();
}
Event::ZoomOut => {
source_pane.update(cx, |pane, cx| {
pane.set_zoomed(false, cx);
});
cx.notify();
}
_ => {}
}
}