From 286b97c0de78785a362e613f1dd5e9b4175f385b Mon Sep 17 00:00:00 2001
From: Umesh Yadav <23421535+imumesh18@users.noreply.github.com>
Date: Tue, 10 Jun 2025 20:29:42 +0530
Subject: [PATCH] agent: Fix agent panel model selector layout pushing send
button off screen (#32251)
| Before | After |
|--------|-------|
| | |
While working on something else I found this weird behaviour in message
editor of agent panel. When model names are too long, the model selector
would expand and push the send button outside the visible area. This
change fixes the flex layout to ensure the send button always remains
accessible while properly truncating long model names.
Closes #ISSUE
Release Notes:
- Fix agent panel model selector layout pushing send button off screen
---------
Co-authored-by: Danilo Leal
Co-authored-by: Danilo Leal <67129314+danilo-leal@users.noreply.github.com>
---
crates/agent/src/agent_model_selector.rs | 5 +++--
crates/agent/src/message_editor.rs | 2 ++
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/crates/agent/src/agent_model_selector.rs b/crates/agent/src/agent_model_selector.rs
index 531661da25..708172057a 100644
--- a/crates/agent/src/agent_model_selector.rs
+++ b/crates/agent/src/agent_model_selector.rs
@@ -91,12 +91,13 @@ impl AgentModelSelector {
impl Render for AgentModelSelector {
fn render(&mut self, window: &mut Window, cx: &mut Context) -> impl IntoElement {
- let focus_handle = self.focus_handle.clone();
-
let model = self.selector.read(cx).delegate.active_model(cx);
let model_name = model
.map(|model| model.model.name().0)
.unwrap_or_else(|| SharedString::from("No model selected"));
+
+ let focus_handle = self.focus_handle.clone();
+
PickerPopoverMenu::new(
self.selector.clone(),
Button::new("active-model", model_name)
diff --git a/crates/agent/src/message_editor.rs b/crates/agent/src/message_editor.rs
index a3958d9acb..0e8a0cf93d 100644
--- a/crates/agent/src/message_editor.rs
+++ b/crates/agent/src/message_editor.rs
@@ -722,6 +722,7 @@ impl MessageEditor {
.child(
h_flex()
.flex_none()
+ .flex_wrap()
.justify_between()
.child(
h_flex()
@@ -731,6 +732,7 @@ impl MessageEditor {
.child(
h_flex()
.gap_1()
+ .flex_wrap()
.when(!incompatible_tools.is_empty(), |this| {
this.child(
IconButton::new(