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.

message_editor: Fix image file copied from external files paste inserting filepath text alongside image (#51575)

Suphachai Phetthamrong7c21f5fa4f3e
diff --git a/crates/agent_ui/src/message_editor.rs b/crates/agent_ui/src/message_editor.rs
index 105de5f665c..8ad880bec06 100644
--- a/crates/agent_ui/src/message_editor.rs
+++ b/crates/agent_ui/src/message_editor.rs
@@ -869,7 +869,20 @@ impl MessageEditor {
}
}
+ let has_non_text_content = cx
+ .read_from_clipboard()
+ .map(|item| {
+ item.entries().iter().any(|entry| {
+ matches!(
+ entry,
+ ClipboardEntry::Image(_) | ClipboardEntry::ExternalPaths(_)
+ )
+ })
+ })
+ .unwrap_or(false);
+
if self.prompt_capabilities.borrow().image
+ && has_non_text_content
&& let Some(task) = paste_images_as_context(
self.editor.clone(),
self.mention_set.clone(),
@@ -878,6 +891,7 @@ impl MessageEditor {
cx,
)
{
+ cx.stop_propagation();
task.detach();
return;
}