Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Ensure panel and pane sizes are integral (#8619)
Conrad Irwinb3b94e64ba56
diff --git a/crates/collab_ui/src/chat_panel.rs b/crates/collab_ui/src/chat_panel.rsindex fd238aba0b6..c644ca5ed0b 100644--- a/crates/collab_ui/src/chat_panel.rs+++ b/crates/collab_ui/src/chat_panel.rs@@ -204,7 +204,7 @@ impl ChatPanel {let panel = Self::new(workspace, cx);if let Some(serialized_panel) = serialized_panel {panel.update(cx, |panel, cx| {- panel.width = serialized_panel.width;+ panel.width = serialized_panel.width.map(|r| r.round());cx.notify();});}diff --git a/crates/collab_ui/src/collab_panel.rs b/crates/collab_ui/src/collab_panel.rsindex 396217f6c15..da3301ecc91 100644--- a/crates/collab_ui/src/collab_panel.rs+++ b/crates/collab_ui/src/collab_panel.rs@@ -327,7 +327,7 @@ impl CollabPanel {let panel = CollabPanel::new(workspace, cx);if let Some(serialized_panel) = serialized_panel {panel.update(cx, |panel, cx| {- panel.width = serialized_panel.width;+ panel.width = serialized_panel.width.map(|w| w.round());panel.collapsed_channels = serialized_panel.collapsed_channels.unwrap_or_else(|| Vec::new())diff --git a/crates/collab_ui/src/notification_panel.rs b/crates/collab_ui/src/notification_panel.rsindex 311481c7561..ecf6f3d7de8 100644--- a/crates/collab_ui/src/notification_panel.rs+++ b/crates/collab_ui/src/notification_panel.rs@@ -183,7 +183,7 @@ impl NotificationPanel {let panel = Self::new(workspace, cx);if let Some(serialized_panel) = serialized_panel {panel.update(cx, |panel, cx| {- panel.width = serialized_panel.width;+ panel.width = serialized_panel.width.map(|w| w.round());cx.notify();});}diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rsindex daeff4844fb..7e4dfad5532 100644--- a/crates/project_panel/src/project_panel.rs+++ b/crates/project_panel/src/project_panel.rs@@ -338,7 +338,7 @@ impl ProjectPanel {let panel = ProjectPanel::new(workspace, cx);if let Some(serialized_panel) = serialized_panel {panel.update(cx, |panel, cx| {- panel.width = serialized_panel.width;+ panel.width = serialized_panel.width.map(|px| px.round());cx.notify();});}diff --git a/crates/terminal_view/src/terminal_panel.rs b/crates/terminal_view/src/terminal_panel.rsindex 9d820aad1c6..4ab3d371e0f 100644--- a/crates/terminal_view/src/terminal_panel.rs+++ b/crates/terminal_view/src/terminal_panel.rs@@ -192,8 +192,8 @@ impl TerminalPanel {let items = if let Some(serialized_panel) = serialized_panel.as_ref() {panel.update(cx, |panel, cx| {cx.notify();- panel.height = serialized_panel.height;- panel.width = serialized_panel.width;+ panel.height = serialized_panel.height.map(|h| h.round());+ panel.width = serialized_panel.width.map(|w| w.round());panel.pane.update(cx, |_, cx| {serialized_panel.itemsdiff --git a/crates/workspace/src/dock.rs b/crates/workspace/src/dock.rsindex afedb7645b2..70059e47b61 100644--- a/crates/workspace/src/dock.rs+++ b/crates/workspace/src/dock.rs@@ -522,7 +522,7 @@ impl Dock {pub fn resize_active_panel(&mut self, size: Option<Pixels>, cx: &mut ViewContext<Self>) {if let Some(entry) = self.panel_entries.get_mut(self.active_panel_index) {- let size = size.map(|size| size.max(RESIZE_HANDLE_SIZE));+ let size = size.map(|size| size.max(RESIZE_HANDLE_SIZE).round());entry.panel.set_size(size, cx);cx.notify();}diff --git a/crates/workspace/src/pane_group.rs b/crates/workspace/src/pane_group.rsindex 6a2a8e8094b..6f55dc800e3 100644--- a/crates/workspace/src/pane_group.rs+++ b/crates/workspace/src/pane_group.rs@@ -883,7 +883,8 @@ mod element {let child_size = bounds.size- .apply_along(self.axis, |_| space_per_flex * child_flex);+ .apply_along(self.axis, |_| space_per_flex * child_flex)+ .map(|d| d.round());let child_bounds = Bounds {origin,