mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-05 02:54:59 +00:00
code_style: simpfy context menu creation for blame editor
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
492da8dd57
commit
fb1f5638ce
1 changed files with 3 additions and 12 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue