agent: Fix clipping in fixed-width (#57726)

Fixed width mode wouldn't reliably take the sidebar width into account
when laying out the content of the agent panel. This fixes it
 
Release Notes:

- N/A or Added/Fixed/Improved ...
This commit is contained in:
Cameron Mcloughlin 2026-05-26 14:23:01 +01:00 committed by GitHub
parent 1dac14c53a
commit 5139a6bfc1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View file

@ -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 {
@ -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(

View file

@ -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);