From 67cf23267a76a5c2727833c5e8716ec34050e03f Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 11 Nov 2024 09:37:27 +0800 Subject: [PATCH] feature: supports open selected revision file with default editor (#674) Signed-off-by: leo --- src/ViewModels/CommitDetail.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/ViewModels/CommitDetail.cs b/src/ViewModels/CommitDetail.cs index 349dc56d..d180f6d6 100644 --- a/src/ViewModels/CommitDetail.cs +++ b/src/ViewModels/CommitDetail.cs @@ -384,6 +384,16 @@ namespace SourceGit.ViewModels ev.Handled = true; }; + var openWith = new MenuItem(); + openWith.Header = App.Text("OpenWith"); + openWith.Icon = App.CreateMenuIcon("Icons.OpenWith"); + openWith.IsEnabled = File.Exists(fullPath); + openWith.Click += (_, ev) => + { + Native.OS.OpenWithDefaultEditor(fullPath); + ev.Handled = true; + }; + var saveAs = new MenuItem(); saveAs.Header = App.Text("SaveAs"); saveAs.Icon = App.CreateMenuIcon("Icons.Save"); @@ -413,6 +423,7 @@ namespace SourceGit.ViewModels }; menu.Items.Add(explore); + menu.Items.Add(openWith); menu.Items.Add(saveAs); menu.Items.Add(new MenuItem() { Header = "-" });