From 300c1c99bf57488f670a6c5186fa4763d937cdd2 Mon Sep 17 00:00:00 2001 From: RevenantX Date: Tue, 23 Jul 2024 21:00:54 +0300 Subject: [PATCH] Add copy info that copies "{Short SHA} - {commit subject}" into clipboard --- src/Resources/Locales/en_US.axaml | 1 + src/ViewModels/Histories.cs | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 9efcc0e1..85ac9f1b 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -97,6 +97,7 @@ Compare with HEAD Compare with Worktree Copy SHA + Copy Info Interactive Rebase ${0}$ to Here Rebase ${0}$ to Here Reset ${0}$ to Here diff --git a/src/ViewModels/Histories.cs b/src/ViewModels/Histories.cs index 15549038..71f3b6f0 100644 --- a/src/ViewModels/Histories.cs +++ b/src/ViewModels/Histories.cs @@ -435,6 +435,17 @@ namespace SourceGit.ViewModels e.Handled = true; }; menu.Items.Add(copySHA); + + var copyInfo = new MenuItem(); + copyInfo.Header = App.Text("CommitCM.CopyInfo"); + copyInfo.Icon = App.CreateMenuIcon("Icons.Copy"); + copyInfo.Click += (_, e) => + { + App.CopyText($"{commit.SHA[..7]} - {commit.Subject}"); + e.Handled = true; + }; + menu.Items.Add(copyInfo); + return menu; }