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.

Merge remote-tracking branch 'origin/main' into code-actions-2

Antonio Scandurraa0987f1121b4
diff --cc crates/gpui2/src/elements/uniform_list.rs
index 679c420cc33,2fe61f5909a..6436d73d684
--- a/crates/gpui2/src/elements/uniform_list.rs
+++ b/crates/gpui2/src/elements/uniform_list.rs
@@@ -192,21 -245,27 +239,22 @@@ impl<V: 'static> Element<V> for Uniform
}
impl<V> UniformList<V> {
- fn measure_item_height(
+ fn measure_first_item(
&self,
view_state: &mut V,
- list_bounds: Bounds<Pixels>,
+ list_width: Option<Pixels>,
cx: &mut ViewContext<V>,
- ) -> Pixels {
+ ) -> Size<Pixels> {
let mut items = (self.render_items)(view_state, 0..1, cx);
- debug_assert!(items.len() == 1);
+ debug_assert_eq!(items.len(), 1);
let mut item_to_measure = items.pop().unwrap();
- item_to_measure.initialize(view_state, cx);
- let layout_id = item_to_measure.layout(view_state, cx);
- cx.compute_layout(
- layout_id,
- Size {
- width: list_width.map_or(AvailableSpace::MinContent, |width| {
- AvailableSpace::Definite(width)
- }),
- height: AvailableSpace::MinContent,
- },
+ let available_space = size(
- AvailableSpace::Definite(list_bounds.size.width),
++ list_width.map_or(AvailableSpace::MinContent, |width| {
++ AvailableSpace::Definite(width)
++ }),
+ AvailableSpace::MinContent,
);
- let size = item_to_measure.measure(available_space, view_state, cx);
- size.height
- cx.layout_bounds(layout_id).size
++ item_to_measure.measure(available_space, view_state, cx)
}
pub fn track_scroll(mut self, handle: UniformListScrollHandle) -> Self {