Skip to content

Commit fb1f563

Browse files
committed
code_style: simpfy context menu creation for blame editor
Signed-off-by: leo <[email protected]>
1 parent 492da8d commit fb1f563

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

src/Views/Blame.axaml.cs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -394,24 +394,15 @@ private void OnTextViewContextRequested(object sender, ContextRequestedEventArgs
394394
if (string.IsNullOrEmpty(selected))
395395
return;
396396

397-
var copy = new MenuItem() { Header = App.Text("Copy") };
397+
var copy = new MenuItem();
398+
copy.Header = App.Text("Copy");
399+
copy.Icon = App.CreateMenuIcon("Icons.Copy");
398400
copy.Click += (_, ev) =>
399401
{
400402
App.CopyText(selected);
401403
ev.Handled = true;
402404
};
403405

404-
if (this.FindResource("Icons.Copy") is StreamGeometry geo)
405-
{
406-
copy.Icon = new Avalonia.Controls.Shapes.Path()
407-
{
408-
Width = 10,
409-
Height = 10,
410-
Stretch = Stretch.Fill,
411-
Data = geo,
412-
};
413-
}
414-
415406
var menu = new ContextMenu();
416407
menu.Items.Add(copy);
417408
menu.Open(TextArea.TextView);

0 commit comments

Comments
 (0)