Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix default window size on small displays (#40398)

localcccc210897367c
diff --git a/crates/gpui/src/platform.rs b/crates/gpui/src/platform.rs
index 6847a34a843..047a005548b 100644
--- a/crates/gpui/src/platform.rs
+++ b/crates/gpui/src/platform.rs
@@ -289,10 +289,13 @@ pub trait PlatformDisplay: Send + Sync + Debug {
/// Get the default bounds for this display to place a window
fn default_bounds(&self) -> Bounds<Pixels> {
- let center = self.bounds().center();
- let offset = DEFAULT_WINDOW_SIZE / 2.0;
+ let bounds = self.bounds();
+ let center = bounds.center();
+ let clipped_window_size = DEFAULT_WINDOW_SIZE.min(&bounds.size);
+
+ let offset = clipped_window_size / 2.0;
let origin = point(center.x - offset.width, center.y - offset.height);
- Bounds::new(origin, DEFAULT_WINDOW_SIZE)
+ Bounds::new(origin, clipped_window_size)
}
}