Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion crates/workspace/src/dock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1046,8 +1046,9 @@ impl Dock {
dispatch_context
}

pub fn clamp_panel_size(&mut self, max_size: Pixels, window: &Window, cx: &mut App) {
pub fn clamp_panel_size(&mut self, max_size: Pixels, window: &Window, cx: &mut Context<Self>) {
let max_size = (max_size - RESIZE_HANDLE_SIZE).abs();
let mut clamped = false;
for entry in &mut self.panel_entries {
let use_flexible = entry.panel.has_flexible_size(window, cx);
if use_flexible {
Expand All @@ -1060,8 +1061,12 @@ impl Dock {
.unwrap_or_else(|| entry.panel.default_size(window, cx));
if size > max_size {
entry.size_state.size = Some(max_size.max(RESIZE_HANDLE_SIZE));
clamped = true;
}
}
if clamped {
cx.notify();
}
}

pub(crate) fn load_persisted_size_state(
Expand Down
6 changes: 6 additions & 0 deletions crates/workspace/src/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7817,6 +7817,12 @@ impl Workspace {
.and_then(|state| state.size)
.unwrap_or_else(|| panel.default_size(window, cx));
container = container.w(size);
// Allow the fixed-width dock to shrink when there isn't
// enough space (e.g. when the sidebar is open). The
// stored size is preserved so the dock expands back
// when space becomes available.
let style = container.style();
style.flex_shrink = Some(1.0);
}
if let Some(min) = min_size {
container = container.min_w(min);
Expand Down
Loading