mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-05 02:20:10 +00:00
Zoom out all panes when opening a dock (#2554)
Fixes https://linear.app/zed-industries/issue/Z-2051/center-zoom-isnt-unset-when-opening-project-panel Release Notes: - Fixed a bug where opening the project panel did not reset the zoom state of a pane.
This commit is contained in:
commit
0bd9d5b1fa
1 changed files with 26 additions and 1 deletions
|
@ -1705,7 +1705,7 @@ impl Workspace {
|
||||||
) {
|
) {
|
||||||
// If a center pane is zoomed, unzoom it.
|
// If a center pane is zoomed, unzoom it.
|
||||||
for pane in &self.panes {
|
for pane in &self.panes {
|
||||||
if pane != &self.active_pane {
|
if pane != &self.active_pane || dock_to_reveal.is_some() {
|
||||||
pane.update(cx, |pane, cx| pane.set_zoomed(false, cx));
|
pane.update(cx, |pane, cx| pane.set_zoomed(false, cx));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4351,6 +4351,12 @@ mod tests {
|
||||||
panel
|
panel
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let pane = workspace.read_with(cx, |workspace, _| workspace.active_pane().clone());
|
||||||
|
pane.update(cx, |pane, cx| {
|
||||||
|
let item = cx.add_view(|_| TestItem::new());
|
||||||
|
pane.add_item(Box::new(item), true, true, None, cx);
|
||||||
|
});
|
||||||
|
|
||||||
// Transfer focus from center to panel
|
// Transfer focus from center to panel
|
||||||
workspace.update(cx, |workspace, cx| {
|
workspace.update(cx, |workspace, cx| {
|
||||||
workspace.toggle_panel_focus::<TestPanel>(cx);
|
workspace.toggle_panel_focus::<TestPanel>(cx);
|
||||||
|
@ -4452,6 +4458,25 @@ mod tests {
|
||||||
assert!(workspace.zoomed.is_some());
|
assert!(workspace.zoomed.is_some());
|
||||||
assert!(panel.has_focus(cx));
|
assert!(panel.has_focus(cx));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Unzoom and close the panel, zoom the active pane.
|
||||||
|
panel.update(cx, |panel, cx| panel.set_zoomed(false, cx));
|
||||||
|
workspace.update(cx, |workspace, cx| {
|
||||||
|
workspace.toggle_dock(DockPosition::Right, cx)
|
||||||
|
});
|
||||||
|
pane.update(cx, |pane, cx| pane.toggle_zoom(&Default::default(), cx));
|
||||||
|
|
||||||
|
// Opening a dock unzooms the pane.
|
||||||
|
workspace.update(cx, |workspace, cx| {
|
||||||
|
workspace.toggle_dock(DockPosition::Right, cx)
|
||||||
|
});
|
||||||
|
workspace.read_with(cx, |workspace, cx| {
|
||||||
|
let pane = pane.read(cx);
|
||||||
|
assert!(!pane.is_zoomed());
|
||||||
|
assert!(pane.has_focus());
|
||||||
|
assert!(workspace.right_dock().read(cx).is_open());
|
||||||
|
assert!(workspace.zoomed.is_none());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[gpui::test]
|
#[gpui::test]
|
||||||
|
|
Loading…
Reference in a new issue