enhance: add "Copy Subject" option to commit context menu

This commit is contained in:
ousugo 2025-04-17 17:49:54 +08:00
parent 3358ff9aee
commit 5c5cc6ab14
2 changed files with 11 additions and 0 deletions

View file

@ -100,6 +100,7 @@
<x:String x:Key="Text.CommitCM.CompareWithHead" xml:space="preserve">Compare with HEAD</x:String>
<x:String x:Key="Text.CommitCM.CompareWithWorktree" xml:space="preserve">Compare with Worktree</x:String>
<x:String x:Key="Text.CommitCM.CopyInfo" xml:space="preserve">Copy Info</x:String>
<x:String x:Key="Text.CommitCM.CopySubject" xml:space="preserve">Copy Subject</x:String>
<x:String x:Key="Text.CommitCM.CopySHA" xml:space="preserve">Copy SHA</x:String>
<x:String x:Key="Text.CommitCM.CustomAction" xml:space="preserve">Custom Action</x:String>
<x:String x:Key="Text.CommitCM.InteractiveRebase" xml:space="preserve">Interactively Rebase ${0}$ on Here</x:String>

View file

@ -713,6 +713,16 @@ namespace SourceGit.ViewModels
menu.Items.Add(new MenuItem() { Header = "-" });
}
var copySubject = new MenuItem();
copySubject.Header = App.Text("CommitCM.CopySubject");
copySubject.Icon = App.CreateMenuIcon("Icons.Copy");
copySubject.Click += (_, e) =>
{
App.CopyText(commit.Subject);
e.Handled = true;
};
menu.Items.Add(copySubject);
var copySHA = new MenuItem();
copySHA.Header = App.Text("CommitCM.CopySHA");
copySHA.Icon = App.CreateMenuIcon("Icons.Copy");