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.

gpui: Allow chaining `flex_grow()` and `flex_shrink()` with custom factors (#58142)

Bowen Xu8982fb17bc58
diff --git a/crates/acp_tools/src/acp_tools.rs b/crates/acp_tools/src/acp_tools.rs
index 695e2beb440..a2fcfe53159 100644
--- a/crates/acp_tools/src/acp_tools.rs
+++ b/crates/acp_tools/src/acp_tools.rs
@@ -767,7 +767,7 @@ impl Render for AcpTools {
} else {
div()
.size_full()
- .flex_grow()
+ .flex_grow_1()
.child(
list(
connection.list_state.clone(),
diff --git a/crates/agent_ui/src/agent_panel.rs b/crates/agent_ui/src/agent_panel.rs
index 45aa0014b1a..a3a6b46d3f0 100644
--- a/crates/agent_ui/src/agent_panel.rs
+++ b/crates/agent_ui/src/agent_panel.rs
@@ -4948,7 +4948,7 @@ impl AgentPanel {
h_flex()
.key_context("TitleEditor")
.group("title_editor")
- .flex_grow()
+ .flex_grow_1()
.w_full()
.min_w_0()
.max_w_full()
diff --git a/crates/agent_ui/src/agent_registry_ui.rs b/crates/agent_ui/src/agent_registry_ui.rs
index c6918d869b7..3f6181321cb 100644
--- a/crates/agent_ui/src/agent_registry_ui.rs
+++ b/crates/agent_ui/src/agent_registry_ui.rs
@@ -650,7 +650,7 @@ impl Render for AgentRegistryPage {
let scroll_handle = &self.list;
this.child(
uniform_list("registry-entries", count, cx.processor(Self::render_agents))
- .flex_grow()
+ .flex_grow_1()
.pb_4()
.track_scroll(scroll_handle),
)
diff --git a/crates/agent_ui/src/conversation_view/thread_view.rs b/crates/agent_ui/src/conversation_view/thread_view.rs
index 3eec4c93ff0..ba3ad0b5e52 100644
--- a/crates/agent_ui/src/conversation_view/thread_view.rs
+++ b/crates/agent_ui/src/conversation_view/thread_view.rs
@@ -2624,7 +2624,7 @@ impl ThreadView {
v_flex()
.when_some(max_content_width, |this, max_w| this.flex_basis(max_w))
.when(max_content_width.is_none(), |this| this.w_full())
- .flex_shrink()
+ .flex_shrink_1()
.flex_grow_0()
.max_w_full()
.bg(self.activity_bar_bg(cx))
@@ -3726,7 +3726,7 @@ impl ThreadView {
.when_some(max_content_width, |this, max_w| this.flex_basis(max_w))
.when(max_content_width.is_none(), |this| this.w_full())
.when(fills_container, |this| this.h_full())
- .flex_shrink()
+ .flex_shrink_1()
.flex_grow_0()
.justify_between()
.gap_2()
@@ -5100,7 +5100,7 @@ impl ThreadView {
}),
)
.with_sizing_behavior(gpui::ListSizingBehavior::Auto)
- .flex_grow()
+ .flex_grow_1()
}
fn render_entry(
diff --git a/crates/agent_ui/src/threads_archive_view.rs b/crates/agent_ui/src/threads_archive_view.rs
index d53a8d473e9..f8583ba5b60 100644
--- a/crates/agent_ui/src/threads_archive_view.rs
+++ b/crates/agent_ui/src/threads_archive_view.rs
@@ -1580,7 +1580,7 @@ impl PickerDelegate for ProjectPickerDelegate {
.child(
h_flex()
.gap_3()
- .flex_grow()
+ .flex_grow_1()
.child(highlighted_match.render(window, cx)),
)
.tooltip(Tooltip::text(tooltip_path))
diff --git a/crates/breadcrumbs/src/breadcrumbs.rs b/crates/breadcrumbs/src/breadcrumbs.rs
index a63a332e4a0..b981e17c33a 100644
--- a/crates/breadcrumbs/src/breadcrumbs.rs
+++ b/crates/breadcrumbs/src/breadcrumbs.rs
@@ -49,7 +49,7 @@ impl Render for Breadcrumbs {
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
let element = h_flex()
.id("breadcrumb-container")
- .flex_grow()
+ .flex_grow_1()
.h_8()
.overflow_x_scroll()
.text_ui(cx);
diff --git a/crates/component_preview/src/component_preview.rs b/crates/component_preview/src/component_preview.rs
index 1409105b12e..73ad50d6a5b 100644
--- a/crates/component_preview/src/component_preview.rs
+++ b/crates/component_preview/src/component_preview.rs
@@ -520,7 +520,7 @@ impl ComponentPreview {
}
}),
)
- .flex_grow()
+ .flex_grow_1()
.with_sizing_behavior(gpui::ListSizingBehavior::Auto)
.into_any_element()
},
diff --git a/crates/debugger_ui/src/session/running/variable_list.rs b/crates/debugger_ui/src/session/running/variable_list.rs
index 4f39ae49db9..cdb5b8122a3 100644
--- a/crates/debugger_ui/src/session/running/variable_list.rs
+++ b/crates/debugger_ui/src/session/running/variable_list.rs
@@ -1574,7 +1574,7 @@ impl Render for VariableList {
.with_horizontal_sizing_behavior(gpui::ListHorizontalSizingBehavior::Unconstrained)
.gap_1_5()
.size_full()
- .flex_grow(),
+ .flex_grow_1(),
)
.children(self.open_context_menu.as_ref().map(|(menu, position, _)| {
deferred(
diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs
index 5474e6e3cb1..dbba534c6fd 100644
--- a/crates/editor/src/element.rs
+++ b/crates/editor/src/element.rs
@@ -6655,7 +6655,7 @@ pub fn render_breadcrumb_text(
) -> gpui::AnyElement {
const MAX_SEGMENTS: usize = 12;
- let element = h_flex().flex_grow().text_ui(cx);
+ let element = h_flex().flex_grow_1().text_ui(cx);
let prefix_end_ix = cmp::min(segments.len(), MAX_SEGMENTS / 2);
let suffix_start_ix = cmp::max(
diff --git a/crates/editor/src/split_editor_view.rs b/crates/editor/src/split_editor_view.rs
index 02388df9a75..468a2bf055c 100644
--- a/crates/editor/src/split_editor_view.rs
+++ b/crates/editor/src/split_editor_view.rs
@@ -210,7 +210,7 @@ impl RenderOnce for SplitEditorView {
.child(
div()
.id("split-editor-left")
- .flex_shrink()
+ .flex_shrink_1()
.min_w_0()
.h_full()
.flex_basis(DefiniteLength::Fraction(left_ratio))
@@ -221,7 +221,7 @@ impl RenderOnce for SplitEditorView {
.child(
div()
.id("split-editor-right")
- .flex_shrink()
+ .flex_shrink_1()
.min_w_0()
.h_full()
.flex_basis(DefiniteLength::Fraction(right_ratio))
diff --git a/crates/extensions_ui/src/extensions_ui.rs b/crates/extensions_ui/src/extensions_ui.rs
index 04c6876b360..a08036059dc 100644
--- a/crates/extensions_ui/src/extensions_ui.rs
+++ b/crates/extensions_ui/src/extensions_ui.rs
@@ -1772,7 +1772,7 @@ impl Render for ExtensionsPage {
let scroll_handle = &self.list;
this.child(
uniform_list("entries", count, cx.processor(Self::render_extensions))
- .flex_grow()
+ .flex_grow_1()
.pb_4()
.track_scroll(scroll_handle),
)
diff --git a/crates/git_ui/src/branch_picker.rs b/crates/git_ui/src/branch_picker.rs
index 6f2276b63fa..eed758ab923 100644
--- a/crates/git_ui/src/branch_picker.rs
+++ b/crates/git_ui/src/branch_picker.rs
@@ -1548,7 +1548,7 @@ impl PickerDelegate for BranchListDelegate {
h_flex()
.w_full()
.gap_2p5()
- .flex_grow()
+ .flex_grow_1()
.child(
Icon::new(entry_icon)
.color(if is_checked_branch {
diff --git a/crates/git_ui/src/commit_modal.rs b/crates/git_ui/src/commit_modal.rs
index c4d791fc7ef..50090a559ca 100644
--- a/crates/git_ui/src/commit_modal.rs
+++ b/crates/git_ui/src/commit_modal.rs
@@ -419,11 +419,11 @@ impl CommitModal {
.child(
h_flex()
.gap_1()
- .flex_shrink()
+ .flex_shrink_1()
.overflow_x_hidden()
.child(
h_flex()
- .flex_shrink()
+ .flex_shrink_1()
.overflow_x_hidden()
.child(branch_picker),
)
diff --git a/crates/git_ui/src/commit_view.rs b/crates/git_ui/src/commit_view.rs
index d9146bda4b0..5e44b24cdae 100644
--- a/crates/git_ui/src/commit_view.rs
+++ b/crates/git_ui/src/commit_view.rs
@@ -1122,7 +1122,7 @@ impl Render for CommitView {
.bg(cx.theme().colors().editor_background)
.child(self.render_header(window, cx))
.when(!self.editor.read(cx).is_empty(cx), |this| {
- this.child(div().flex_grow().child(self.editor.clone()))
+ this.child(div().flex_grow_1().child(self.editor.clone()))
})
}
}
diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs
index 65f5e12759a..feb843d4b4a 100644
--- a/crates/git_ui/src/git_panel.rs
+++ b/crates/git_ui/src/git_panel.rs
@@ -4887,7 +4887,7 @@ impl GitPanel {
.border_color(cx.theme().colors().border.opacity(0.8))
.child(
div()
- .flex_grow()
+ .flex_grow_1()
.overflow_hidden()
.max_w(relative(0.85))
.child(
@@ -5803,7 +5803,7 @@ impl GitPanel {
})
.group("entries")
.size_full()
- .flex_grow()
+ .flex_grow_1()
.with_width_from_item(self.max_width_item_index)
.track_scroll(&self.scroll_handle),
)
diff --git a/crates/gpui/src/styled.rs b/crates/gpui/src/styled.rs
index e090ba973fb..3004e157e47 100644
--- a/crates/gpui/src/styled.rs
+++ b/crates/gpui/src/styled.rs
@@ -200,6 +200,7 @@ pub trait Styled: Sized {
fn flex_none(mut self) -> Self {
self.style().flex_grow = Some(0.);
self.style().flex_shrink = Some(0.);
+ self.style().flex_basis = Some(Length::Auto);
self
}
@@ -210,34 +211,48 @@ pub trait Styled: Sized {
self
}
- /// Sets the element to allow a flex item to grow to fill any available space.
+ /// Sets the flex item's grow factor.
/// [Docs](https://tailwindcss.com/docs/flex-grow)
- fn flex_grow(mut self) -> Self {
- self.style().flex_grow = Some(1.);
+ fn flex_grow(mut self, grow: f32) -> Self {
+ self.style().flex_grow = Some(grow);
self
}
- /// Sets the element to prevent a flex item from growing.
+ /// Disables flex item growth (flex-grow: 0).
/// [Docs](https://tailwindcss.com/docs/flex-grow#dont-grow)
fn flex_grow_0(mut self) -> Self {
self.style().flex_grow = Some(0.);
self
}
- /// Sets the element to allow a flex item to shrink if needed.
+ /// Enables flex item growth (flex-grow: 1).
+ /// [Docs](https://tailwindcss.com/docs/flex-grow#grow-1)
+ fn flex_grow_1(mut self) -> Self {
+ self.style().flex_grow = Some(1.);
+ self
+ }
+
+ /// Sets the flex item's shrink factor.
/// [Docs](https://tailwindcss.com/docs/flex-shrink)
- fn flex_shrink(mut self) -> Self {
- self.style().flex_shrink = Some(1.);
+ fn flex_shrink(mut self, shrink: f32) -> Self {
+ self.style().flex_shrink = Some(shrink);
self
}
- /// Sets the element to prevent a flex item from shrinking.
+ /// Disables flex item shrinking (flex-shrink: 0).
/// [Docs](https://tailwindcss.com/docs/flex-shrink#dont-shrink)
fn flex_shrink_0(mut self) -> Self {
self.style().flex_shrink = Some(0.);
self
}
+ /// Enables flex item shrinking (flex-shrink: 1).
+ /// [Docs](https://tailwindcss.com/docs/flex-shrink#shrink-1)
+ fn flex_shrink_1(mut self) -> Self {
+ self.style().flex_shrink = Some(1.);
+ self
+ }
+
/// Sets the element to allow flex items to wrap.
/// [Docs](https://tailwindcss.com/docs/flex-wrap#wrap-normally)
fn flex_wrap(mut self) -> Self {
diff --git a/crates/keymap_editor/src/keymap_editor.rs b/crates/keymap_editor/src/keymap_editor.rs
index 54c54ab1fca..6677fe667dd 100644
--- a/crates/keymap_editor/src/keymap_editor.rs
+++ b/crates/keymap_editor/src/keymap_editor.rs
@@ -3469,7 +3469,7 @@ impl Render for ActionArgumentsEditor {
.min_h_8()
.min_w_48()
.px_2()
- .flex_grow()
+ .flex_grow_1()
.rounded_md()
.bg(cx.theme().colors().editor_background)
.border_1()
diff --git a/crates/livekit_client/examples/test_app.rs b/crates/livekit_client/examples/test_app.rs
index eb87aa6cae4..f21bc9d3203 100644
--- a/crates/livekit_client/examples/test_app.rs
+++ b/crates/livekit_client/examples/test_app.rs
@@ -350,7 +350,7 @@ impl Render for LivekitWindow {
.overflow_y_scroll()
.flex()
.flex_col()
- .flex_grow()
+ .flex_grow_1()
.children(self.remote_participants.iter().map(|(identity, state)| {
div()
.h(px(1080.0))
diff --git a/crates/outline_panel/src/outline_panel.rs b/crates/outline_panel/src/outline_panel.rs
index c9812e5ee38..a3203e3958f 100644
--- a/crates/outline_panel/src/outline_panel.rs
+++ b/crates/outline_panel/src/outline_panel.rs
@@ -4786,9 +4786,9 @@ impl OutlinePanel {
};
v_flex()
- .flex_shrink()
+ .flex_shrink_1()
.size_full()
- .child(list_contents.size_full().flex_shrink())
+ .child(list_contents.size_full().flex_shrink_1())
.custom_scrollbars(
Scrollbars::for_settings::<OutlinePanelSettingsScrollbarProxy>()
.tracked_scroll_handle(&self.scroll_handle.clone())
diff --git a/crates/picker/src/picker.rs b/crates/picker/src/picker.rs
index 0ff12127237..d5220ae14f3 100644
--- a/crates/picker/src/picker.rs
+++ b/crates/picker/src/picker.rs
@@ -881,7 +881,7 @@ impl<D: PickerDelegate> Picker<D> {
.when_some(self.widest_item, |el, widest_item| {
el.with_width_from_item(Some(widest_item))
})
- .flex_grow()
+ .flex_grow_1()
.py(DynamicSpacing::Base04.rems(cx))
.track_scroll(&scroll_handle)
.into_any_element(),
@@ -892,7 +892,7 @@ impl<D: PickerDelegate> Picker<D> {
}),
)
.with_sizing_behavior(sizing_behavior)
- .flex_grow()
+ .flex_grow_1()
.py(DynamicSpacing::Base04.rems(cx))
.into_any_element(),
}
@@ -1140,7 +1140,7 @@ impl<D: PickerDelegate> Render for Picker<D> {
v_flex()
.id("element-container")
.relative()
- .flex_grow()
+ .flex_grow_1()
.when_some(self.max_height, |div, max_h| div.max_h(max_h))
.overflow_hidden()
.children(self.delegate.render_header(window, cx))
@@ -1167,7 +1167,7 @@ impl<D: PickerDelegate> Render for Picker<D> {
el.when_some(self.delegate.no_matches_text(window, cx), |el, text| {
el.child(
v_flex()
- .flex_grow()
+ .flex_grow_1()
.py(DynamicSpacing::Base04.rems(cx))
.child(
ListItem::new("empty_state")
diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs
index 02aa6cddf28..8cce8ab4422 100644
--- a/crates/project_panel/src/project_panel.rs
+++ b/crates/project_panel/src/project_panel.rs
@@ -6932,7 +6932,7 @@ impl Render for ProjectPanel {
div()
.id("project-panel-blank-area")
.block_mouse_except_scroll()
- .flex_grow()
+ .flex_grow_1()
.on_scroll_wheel({
let scroll_handle = self.scroll_handle.clone();
let entity_id = cx.entity().entity_id();
diff --git a/crates/recent_projects/src/recent_projects.rs b/crates/recent_projects/src/recent_projects.rs
index 712dd34f353..80733c32255 100644
--- a/crates/recent_projects/src/recent_projects.rs
+++ b/crates/recent_projects/src/recent_projects.rs
@@ -1561,7 +1561,7 @@ impl PickerDelegate for RecentProjectsDelegate {
h_flex()
.id("project_info_container")
.gap_2p5()
- .flex_grow()
+ .flex_grow_1()
.when(self.has_any_non_local_projects, |this| {
this.child(Icon::new(icon).color(Color::Muted))
})
diff --git a/crates/recent_projects/src/sidebar_recent_projects.rs b/crates/recent_projects/src/sidebar_recent_projects.rs
index 0b4d3722a34..c5d1203bf28 100644
--- a/crates/recent_projects/src/sidebar_recent_projects.rs
+++ b/crates/recent_projects/src/sidebar_recent_projects.rs
@@ -369,7 +369,7 @@ impl PickerDelegate for SidebarRecentProjectsDelegate {
.child(
h_flex()
.gap_3()
- .flex_grow()
+ .flex_grow_1()
.when(self.has_any_non_local_projects, |this| {
this.child(Icon::new(icon).color(Color::Muted))
})
diff --git a/crates/recent_projects/src/wsl_picker.rs b/crates/recent_projects/src/wsl_picker.rs
index e0930fde365..b09a040caa9 100644
--- a/crates/recent_projects/src/wsl_picker.rs
+++ b/crates/recent_projects/src/wsl_picker.rs
@@ -172,7 +172,7 @@ impl picker::PickerDelegate for WslPickerDelegate {
.spacing(ui::ListItemSpacing::Sparse)
.child(
h_flex()
- .flex_grow()
+ .flex_grow_1()
.gap_3()
.child(Icon::new(IconName::Linux))
.child(v_flex().child(HighlightedLabel::new(
diff --git a/crates/repl/src/components/kernel_options.rs b/crates/repl/src/components/kernel_options.rs
index 32db5785884..e8fc7bee363 100644
--- a/crates/repl/src/components/kernel_options.rs
+++ b/crates/repl/src/components/kernel_options.rs
@@ -362,7 +362,7 @@ impl PickerDelegate for KernelPickerDelegate {
.child(icon.color(Color::Default).size(IconSize::Medium))
.child(
v_flex()
- .flex_grow()
+ .flex_grow_1()
.overflow_x_hidden()
.gap_0p5()
.child(
@@ -371,7 +371,7 @@ impl PickerDelegate for KernelPickerDelegate {
.child(
div()
.overflow_x_hidden()
- .flex_shrink()
+ .flex_shrink_1()
.text_ellipsis()
.child(
Label::new(spec.name())
diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs
index 93e4b3f9d13..e5530717516 100644
--- a/crates/search/src/project_search.rs
+++ b/crates/search/src/project_search.rs
@@ -2199,7 +2199,7 @@ impl Render for ProjectSearchBar {
let input_base_styles = |panel: InputPanel| {
input_base_styles(search.border_color_for(panel, cx), |div| match panel {
InputPanel::Query | InputPanel::Replacement => div.w(input_width),
- InputPanel::Include | InputPanel::Exclude => div.flex_grow(),
+ InputPanel::Include | InputPanel::Exclude => div.flex_grow_1(),
})
};
let theme_colors = cx.theme().colors();
diff --git a/crates/skill_creator/src/skill_creator.rs b/crates/skill_creator/src/skill_creator.rs
index ffbe28801ad..947302df9d9 100644
--- a/crates/skill_creator/src/skill_creator.rs
+++ b/crates/skill_creator/src/skill_creator.rs
@@ -898,7 +898,7 @@ impl SkillCreator {
// than squeezing the body editor below its minimum height.
v_flex()
.id("skill-creator-form-fields")
- .flex_grow()
+ .flex_grow_1()
.flex_shrink_0()
.gap_4()
.child(
@@ -914,7 +914,7 @@ impl SkillCreator {
.child(Divider::horizontal())
.child(
v_flex()
- .flex_grow()
+ .flex_grow_1()
.flex_shrink_0()
.gap_2()
.child(Label::new("Skill Content"))
diff --git a/crates/terminal_view/src/terminal_view.rs b/crates/terminal_view/src/terminal_view.rs
index 68c4281441a..92e5046cbb3 100644
--- a/crates/terminal_view/src/terminal_view.rs
+++ b/crates/terminal_view/src/terminal_view.rs
@@ -1378,7 +1378,7 @@ impl Item for TerminalView {
v_flex()
.gap_1()
.child(Label::new(title.clone()))
- .child(h_flex().flex_grow().child(Divider::horizontal()))
+ .child(h_flex().flex_grow_1().child(Divider::horizontal()))
.child(
Label::new(format!("Process ID (PID): {}", pid))
.color(Color::Muted)
diff --git a/crates/ui/src/components/button/split_button.rs b/crates/ui/src/components/button/split_button.rs
index 7871ea3e98c..6b432726fdb 100644
--- a/crates/ui/src/components/button/split_button.rs
+++ b/crates/ui/src/components/button/split_button.rs
@@ -76,7 +76,7 @@ impl RenderOnce for SplitButton {
.when(self.style == SplitButtonStyle::Transparent, |this| {
this.gap_px()
})
- .child(div().flex_grow().child(match self.left {
+ .child(div().flex_grow_1().child(match self.left {
SplitButtonKind::ButtonLike(button) => button.into_any_element(),
SplitButtonKind::IconButton(icon) => icon.into_any_element(),
}))
diff --git a/crates/ui/src/components/data_table.rs b/crates/ui/src/components/data_table.rs
index 42f6a9150fb..77061dbfa71 100644
--- a/crates/ui/src/components/data_table.rs
+++ b/crates/ui/src/components/data_table.rs
@@ -652,7 +652,7 @@ pub fn render_table_row(
// restrict_scroll_to_axis lets vertical scroll events pass through to the list.
let mut scrollable_section = div()
.id(("table-row-scrollable", row_index as u64))
- .flex_grow()
+ .flex_grow_1()
.overflow_x_scroll()
.flex()
.child(
@@ -769,7 +769,7 @@ pub fn render_table_header(
);
let mut scrollable_section = div()
.id("table-header-scrollable")
- .flex_grow()
+ .flex_grow_1()
.overflow_x_scroll()
.flex()
.child(inner);
@@ -1136,7 +1136,7 @@ impl RenderOnce for Table {
})
.child({
let content = div()
- .flex_grow()
+ .flex_grow_1()
.w_full()
.relative()
.overflow_hidden()
@@ -1180,7 +1180,7 @@ impl RenderOnce for Table {
},
)
.size_full()
- .flex_grow()
+ .flex_grow_1()
.with_sizing_behavior(ListSizingBehavior::Auto)
.with_horizontal_sizing_behavior(horizontal_sizing)
.when_some(
@@ -1208,7 +1208,7 @@ impl RenderOnce for Table {
}
})
.size_full()
- .flex_grow()
+ .flex_grow_1()
.with_sizing_behavior(ListSizingBehavior::Auto),
),
})
@@ -1237,7 +1237,7 @@ impl RenderOnce for Table {
let mut h_scroll_container = div()
.id("table-h-scroll")
.overflow_x_scroll()
- .flex_grow()
+ .flex_grow_1()
.h_full()
.track_scroll(&state.read(cx).horizontal_scroll_handle)
.child(table);
diff --git a/crates/ui/src/components/list/list_item.rs b/crates/ui/src/components/list/list_item.rs
index 06be27abab2..8f5ccadcaf2 100644
--- a/crates/ui/src/components/list/list_item.rs
+++ b/crates/ui/src/components/list/list_item.rs
@@ -336,7 +336,7 @@ impl RenderOnce for ListItem {
}))
.child(
h_flex()
- .flex_grow()
+ .flex_grow_1()
.flex_shrink_0()
.flex_basis(relative(0.25))
.gap(DynamicSpacing::Base06.rems(cx))
@@ -354,16 +354,16 @@ impl RenderOnce for ListItem {
.when_some(self.end_slot, |this, end_slot| {
this.child(match self.end_slot_visibility {
EndSlotVisibility::Always => {
- h_flex().flex_shrink().overflow_hidden().child(end_slot)
+ h_flex().flex_shrink_1().overflow_hidden().child(end_slot)
}
EndSlotVisibility::OnHover => h_flex()
- .flex_shrink()
+ .flex_shrink_1()
.overflow_hidden()
.visible_on_hover("list_item")
.child(end_slot),
EndSlotVisibility::SwapOnHover(hover_slot) => h_flex()
.relative()
- .flex_shrink()
+ .flex_shrink_1()
.child(h_flex().visible_on_hover("list_item").child(hover_slot))
.child(
h_flex()
diff --git a/crates/ui/src/components/tab_bar.rs b/crates/ui/src/components/tab_bar.rs
index 0891b3ac1f4..524f880398b 100644
--- a/crates/ui/src/components/tab_bar.rs
+++ b/crates/ui/src/components/tab_bar.rs
@@ -129,7 +129,7 @@ impl RenderOnce for TabBar {
.child(
h_flex()
.id("tabs")
- .flex_grow()
+ .flex_grow_1()
.overflow_x_scroll()
.when_some(self.scroll_handle, |cx, scroll_handle| {
cx.track_scroll(&scroll_handle)
diff --git a/crates/ui/src/components/tree_view_item.rs b/crates/ui/src/components/tree_view_item.rs
index 9474548675d..31cdfd33bdd 100644
--- a/crates/ui/src/components/tree_view_item.rs
+++ b/crates/ui/src/components/tree_view_item.rs
@@ -193,7 +193,7 @@ impl RenderOnce for TreeViewItem {
h_flex()
.id("nested_inner_tree_view_item")
.w_full()
- .flex_grow()
+ .flex_grow_1()
.child(
Label::new(label)
.when(!self.selected, |this| this.color(Color::Muted)),
diff --git a/crates/ui_input/src/input_field.rs b/crates/ui_input/src/input_field.rs
index 8a95651950a..b384fd388ed 100644
--- a/crates/ui_input/src/input_field.rs
+++ b/crates/ui_input/src/input_field.rs
@@ -176,7 +176,7 @@ impl Render for InputField {
.w_full()
.px_2()
.py_1p5()
- .flex_grow()
+ .flex_grow_1()
.text_color(style.text_color)
.rounded_md()
.bg(style.background_color)
diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs
index 4a2204d4c5f..3a44e051167 100644
--- a/crates/workspace/src/pane.rs
+++ b/crates/workspace/src/pane.rs
@@ -3630,7 +3630,7 @@ impl Pane {
.id("tab_bar_drop_target")
.min_w_6()
.h(Tab::container_height(cx))
- .flex_grow()
+ .flex_grow_1()
// HACK: This empty child is currently necessary to force the drop target to appear
// despite us setting a min width above.
.child("")
@@ -3674,7 +3674,7 @@ impl Pane {
.debug_selector(|| "pinned_tabs_border".into())
.min_w_6()
.h(Tab::container_height(cx))
- .flex_grow()
+ .flex_grow_1()
.border_l_1()
.border_color(cx.theme().colors().border)
// HACK: This empty child is currently necessary to force the drop target to appear
diff --git a/crates/zed/src/zed/quick_action_bar/repl_menu.rs b/crates/zed/src/zed/quick_action_bar/repl_menu.rs
index 7b694281b99..7d8b6ae7694 100644
--- a/crates/zed/src/zed/quick_action_bar/repl_menu.rs
+++ b/crates/zed/src/zed/quick_action_bar/repl_menu.rs
@@ -344,7 +344,7 @@ impl QuickActionBar {
.child(
div()
.overflow_x_hidden()
- .flex_grow()
+ .flex_grow_1()
.whitespace_nowrap()
.child(
Label::new(if let Some(name) = current_kernel_name {
diff --git a/crates/zed/src/zed/telemetry_log.rs b/crates/zed/src/zed/telemetry_log.rs
index 062fd5f0f28..a935e29d94a 100644
--- a/crates/zed/src/zed/telemetry_log.rs
+++ b/crates/zed/src/zed/telemetry_log.rs
@@ -518,7 +518,7 @@ impl Render for TelemetryLogView {
} else {
div()
.size_full()
- .flex_grow()
+ .flex_grow_1()
.child(
list(self.list_state.clone(), cx.processor(Self::render_entry))
.with_sizing_behavior(gpui::ListSizingBehavior::Auto)