From fb1f5638ce4cadebd05ab8ce25f1c0c9f391f6d1 Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 23 May 2025 10:31:11 +0800 Subject: [PATCH] code_style: simpfy context menu creation for blame editor Signed-off-by: leo --- src/Views/Blame.axaml.cs | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/Views/Blame.axaml.cs b/src/Views/Blame.axaml.cs index 49b637a2..00342b0b 100644 --- a/src/Views/Blame.axaml.cs +++ b/src/Views/Blame.axaml.cs @@ -394,24 +394,15 @@ namespace SourceGit.Views if (string.IsNullOrEmpty(selected)) return; - var copy = new MenuItem() { Header = App.Text("Copy") }; + var copy = new MenuItem(); + copy.Header = App.Text("Copy"); + copy.Icon = App.CreateMenuIcon("Icons.Copy"); copy.Click += (_, ev) => { App.CopyText(selected); ev.Handled = true; }; - if (this.FindResource("Icons.Copy") is StreamGeometry geo) - { - copy.Icon = new Avalonia.Controls.Shapes.Path() - { - Width = 10, - Height = 10, - Stretch = Stretch.Fill, - Data = geo, - }; - } - var menu = new ContextMenu(); menu.Items.Add(copy); menu.Open(TextArea.TextView);