agent: Prevent sending whitespace only messages (#28409)

5brian created

Prevent this from happening when sending a prompt with only spaces and
newlines:


![image](https://github.com/user-attachments/assets/b275f4c5-c013-4695-8fb4-e3ad75d41750)

Release Notes:

- agent: Prevent from sending messages containing only white space.

Change summary

crates/agent/src/message_editor.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Detailed changes

crates/agent/src/message_editor.rs 🔗

@@ -201,7 +201,7 @@ impl MessageEditor {
     }
 
     fn is_editor_empty(&self, cx: &App) -> bool {
-        self.editor.read(cx).text(cx).is_empty()
+        self.editor.read(cx).text(cx).trim().is_empty()
     }
 
     fn is_model_selected(&self, cx: &App) -> bool {