Skip to content

Commit 08af39d

Browse files
feature: supports to copy full commit message (#1521)
Co-authored-by: leo <[email protected]>
1 parent 24fcaa1 commit 08af39d

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/Resources/Locales/en_US.axaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@
120120
<x:String x:Key="Text.CommitCM.CompareWithWorktree" xml:space="preserve">Compare with Worktree</x:String>
121121
<x:String x:Key="Text.CommitCM.CopyAuthor" xml:space="preserve">Author</x:String>
122122
<x:String x:Key="Text.CommitCM.CopyCommitter" xml:space="preserve">Committer</x:String>
123+
<x:String x:Key="Text.CommitCM.CopyCommitMessage" xml:space="preserve">Message</x:String>
123124
<x:String x:Key="Text.CommitCM.CopySHA" xml:space="preserve">SHA</x:String>
124125
<x:String x:Key="Text.CommitCM.CopySubject" xml:space="preserve">Subject</x:String>
125126
<x:String x:Key="Text.CommitCM.CustomAction" xml:space="preserve">Custom Action</x:String>

src/ViewModels/Histories.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,17 @@ public ContextMenu MakeContextMenu(DataGrid list)
845845
e.Handled = true;
846846
};
847847

848+
var copyFullInfo = new MenuItem();
849+
copyFullInfo.Header = App.Text("CommitCM.CopyCommitMessage");
850+
copyFullInfo.Icon = App.CreateMenuIcon("Icons.Info");
851+
copyFullInfo.Click += async (_, e) =>
852+
{
853+
var message = await new Commands.QueryCommitFullMessage(_repo.FullPath, commit.SHA).
854+
GetResultAsync().ConfigureAwait(false);
855+
await App.CopyTextAsync(message);
856+
e.Handled = true;
857+
};
858+
848859
var copyAuthor = new MenuItem();
849860
copyAuthor.Header = App.Text("CommitCM.CopyAuthor");
850861
copyAuthor.Icon = App.CreateMenuIcon("Icons.User");
@@ -869,6 +880,7 @@ public ContextMenu MakeContextMenu(DataGrid list)
869880
copy.Items.Add(copySHA);
870881
copy.Items.Add(copySubject);
871882
copy.Items.Add(copyInfo);
883+
copy.Items.Add(copyFullInfo);
872884
copy.Items.Add(copyAuthor);
873885
copy.Items.Add(copyCommitter);
874886
menu.Items.Add(copy);

0 commit comments

Comments
 (0)