agent: Fix text wrapping in the provider set up list items (#33063)

Danilo Leal created

Release Notes:

- agent: Fixed text wrapping in the provider set up list items in the
settings view.

Change summary

crates/language_models/src/ui/instruction_list_item.rs | 41 ++++++-----
1 file changed, 21 insertions(+), 20 deletions(-)

Detailed changes

crates/language_models/src/ui/instruction_list_item.rs 🔗

@@ -40,29 +40,30 @@ impl IntoElement for InstructionListItem {
             let link = button_link.clone();
             let unique_id = SharedString::from(format!("{}-button", self.label));
 
-            h_flex().flex_wrap().child(Label::new(self.label)).child(
-                Button::new(unique_id, button_label)
-                    .style(ButtonStyle::Subtle)
-                    .icon(IconName::ArrowUpRight)
-                    .icon_size(IconSize::XSmall)
-                    .icon_color(Color::Muted)
-                    .on_click(move |_, _window, cx| cx.open_url(&link)),
-            )
+            h_flex()
+                .flex_wrap()
+                .child(Label::new(self.label))
+                .child(
+                    Button::new(unique_id, button_label)
+                        .style(ButtonStyle::Subtle)
+                        .icon(IconName::ArrowUpRight)
+                        .icon_size(IconSize::XSmall)
+                        .icon_color(Color::Muted)
+                        .on_click(move |_, _window, cx| cx.open_url(&link)),
+                )
+                .into_any_element()
         } else {
-            div().child(Label::new(self.label))
+            Label::new(self.label).into_any_element()
         };
 
-        div()
-            .child(
-                ListItem::new("list-item")
-                    .selectable(false)
-                    .start_slot(
-                        Icon::new(IconName::Dash)
-                            .size(IconSize::XSmall)
-                            .color(Color::Hidden),
-                    )
-                    .child(item_content),
+        ListItem::new("list-item")
+            .selectable(false)
+            .start_slot(
+                Icon::new(IconName::Dash)
+                    .size(IconSize::XSmall)
+                    .color(Color::Hidden),
             )
-            .into_any()
+            .child(div().w_full().child(item_content))
+            .into_any_element()
     }
 }