mirror of
https://github.com/zed-industries/zed.git
synced 2026-06-01 03:14:56 +07:00
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:
parent
1dac14c53a
commit
5139a6bfc1
2 changed files with 12 additions and 1 deletions
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue