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.

Remove CopyAsMarkdown (#44933)

Michael Benfieldc3b08609094a
diff --git a/assets/keymaps/default-linux.json b/assets/keymaps/default-linux.json
index bb49582ce0e..38ef7d092d5 100644
--- a/assets/keymaps/default-linux.json
+++ b/assets/keymaps/default-linux.json
@@ -262,9 +262,9 @@
{
"context": "AgentPanel > Markdown",
"bindings": {
- "copy": "markdown::CopyAsMarkdown",
- "ctrl-insert": "markdown::CopyAsMarkdown",
- "ctrl-c": "markdown::CopyAsMarkdown",
+ "copy": "markdown::Copy",
+ "ctrl-insert": "markdown::Copy",
+ "ctrl-c": "markdown::Copy",
},
},
{
diff --git a/assets/keymaps/default-macos.json b/assets/keymaps/default-macos.json
index 3c6ec6e0423..8a0e3dfdcdd 100644
--- a/assets/keymaps/default-macos.json
+++ b/assets/keymaps/default-macos.json
@@ -303,7 +303,7 @@
"context": "AgentPanel > Markdown",
"use_key_equivalents": true,
"bindings": {
- "cmd-c": "markdown::CopyAsMarkdown",
+ "cmd-c": "markdown::Copy",
},
},
{
diff --git a/assets/keymaps/default-windows.json b/assets/keymaps/default-windows.json
index b15313fe75c..e344ea356fb 100644
--- a/assets/keymaps/default-windows.json
+++ b/assets/keymaps/default-windows.json
@@ -265,7 +265,7 @@
"context": "AgentPanel > Markdown",
"use_key_equivalents": true,
"bindings": {
- "ctrl-c": "markdown::CopyAsMarkdown",
+ "ctrl-c": "markdown::Copy",
},
},
{
diff --git a/crates/markdown/src/markdown.rs b/crates/markdown/src/markdown.rs
index 6f4ebe4a91f..270192107c1 100644
--- a/crates/markdown/src/markdown.rs
+++ b/crates/markdown/src/markdown.rs
@@ -149,8 +149,6 @@ actions!(
[
/// Copies the selected text to the clipboard.
Copy,
- /// Copies the selected text as markdown to the clipboard.
- CopyAsMarkdown
]
);
@@ -295,14 +293,6 @@ impl Markdown {
cx.write_to_clipboard(ClipboardItem::new_string(text));
}
- fn copy_as_markdown(&self, _: &mut Window, cx: &mut Context<Self>) {
- if self.selection.end <= self.selection.start {
- return;
- }
- let text = self.source[self.selection.start..self.selection.end].to_string();
- cx.write_to_clipboard(ClipboardItem::new_string(text));
- }
-
fn parse(&mut self, cx: &mut Context<Self>) {
if self.source.is_empty() {
return;
@@ -1360,14 +1350,6 @@ impl Element for MarkdownElement {
}
}
});
- window.on_action(std::any::TypeId::of::<crate::CopyAsMarkdown>(), {
- let entity = self.markdown.clone();
- move |_, phase, window, cx| {
- if phase == DispatchPhase::Bubble {
- entity.update(cx, move |this, cx| this.copy_as_markdown(window, cx))
- }
- }
- });
self.paint_mouse_listeners(hitbox, &rendered_markdown.text, window, cx);
rendered_markdown.element.paint(window, cx);