From f2e7c635ac367e1306df425a46d90401dbe5c573 Mon Sep 17 00:00:00 2001 From: Vitaly Slobodin Date: Thu, 16 May 2024 14:59:17 +0200 Subject: [PATCH] editor: Add Cut, Copy, and Paste actions to the context menu (#11878) Hi, I saw someone on Twitter mentioned that missing Cut, Copy and Paste actions in the context menu in the editor block them from using Zed. It turns out that resolving this issue is simply a matter of adding these actions to the mouse context menu. To keep items in the context menu grouped, I placed them at the top of the menu with a separator at the end. Let me know if that's OK. Thanks! Here is the screenshot: ![CleanShot 2024-05-16 at 07 04 44@2x](https://github.com/zed-industries/zed/assets/1894248/2ac84001-cdd7-4c01-b597-c5b1dc3e7fa3) Release Notes: - Added "Cut", "Copy", and "Paste" actions to the context menu ([#4280](https://github.com/zed-industries/zed/issues/4280)). --- crates/editor/src/mouse_context_menu.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/editor/src/mouse_context_menu.rs b/crates/editor/src/mouse_context_menu.rs index 4f5abc4cec..09cefc0de2 100644 --- a/crates/editor/src/mouse_context_menu.rs +++ b/crates/editor/src/mouse_context_menu.rs @@ -1,6 +1,7 @@ use crate::{ - DisplayPoint, Editor, EditorMode, FindAllReferences, GoToDefinition, GoToImplementation, - GoToTypeDefinition, Rename, RevealInFinder, SelectMode, ToggleCodeActions, + Copy, Cut, DisplayPoint, Editor, EditorMode, FindAllReferences, GoToDefinition, + GoToImplementation, GoToTypeDefinition, Paste, Rename, RevealInFinder, SelectMode, + ToggleCodeActions, }; use gpui::{DismissEvent, Pixels, Point, Subscription, View, ViewContext}; use workspace::OpenInTerminal; @@ -85,6 +86,10 @@ pub fn deploy_context_menu( }), ) .separator() + .action("Cut", Box::new(Cut)) + .action("Copy", Box::new(Copy)) + .action("Paste", Box::new(Paste)) + .separator() .action("Reveal in Finder", Box::new(RevealInFinder)) .action("Open in Terminal", Box::new(OpenInTerminal)); match focus {