diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml
index 9abb3bdcc..2c4a1461e 100644
--- a/src/Resources/Locales/en_US.axaml
+++ b/src/Resources/Locales/en_US.axaml
@@ -313,6 +313,7 @@
Short Description:
Type of Change:
Copy
+ Copy: {0}
Copy All Text
Copy as Patch
Copy Full Path
diff --git a/src/Views/CommitBaseInfo.axaml b/src/Views/CommitBaseInfo.axaml
index d6c0dba6b..9c55acb85 100644
--- a/src/Views/CommitBaseInfo.axaml
+++ b/src/Views/CommitBaseInfo.axaml
@@ -19,18 +19,24 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -39,18 +45,24 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -62,10 +74,9 @@
-
-
-
-
+
+
+
diff --git a/src/Views/CommitRefsPresenter.cs b/src/Views/CommitRefsPresenter.cs
index 85e33962a..4646f8a65 100644
--- a/src/Views/CommitRefsPresenter.cs
+++ b/src/Views/CommitRefsPresenter.cs
@@ -277,10 +277,13 @@ protected override Size MeasureOverride(Size availableSize)
{
_items.Clear();
- if (DataContext is not Models.Commit commit)
- return new Size(0, 0);
-
- var refs = commit.Decorators;
+ var commit = DataContext as Models.Commit;
+ List refs = DataContext switch
+ {
+ Models.Commit c => c.Decorators,
+ Models.Decorator decorator => [decorator],
+ _ => [],
+ };
var count = refs.Count;
if (count == 0)
{
@@ -294,7 +297,7 @@ protected override Size MeasureOverride(Size availableSize)
var typefaceHead = new Typeface(FontFamily, FontStyle.Normal, FontWeight.Bold);
var typefaceRemote = new Typeface(FontFamily, FontStyle.Italic, FontWeight.Bold);
var fg = Foreground;
- var normalBG = UseGraphColor ? Models.CommitGraph.Pens[commit.Color].Brush : Brushes.Gray;
+ var normalBG = UseGraphColor && commit != null ? Models.CommitGraph.Pens[commit.Color].Brush : Brushes.Gray;
var labelSize = FontSize;
var requiredHeight = 16.0;
var x = 0.0;
diff --git a/src/Views/CopyButton.cs b/src/Views/CopyButton.cs
index 0ce790849..2532d8483 100644
--- a/src/Views/CopyButton.cs
+++ b/src/Views/CopyButton.cs
@@ -13,6 +13,15 @@ public class CopyButton : Button
{
protected override Type StyleKeyOverride => typeof(Button);
+ public static readonly StyledProperty IconProperty =
+ AvaloniaProperty.Register(nameof(Icon));
+
+ public Geometry Icon
+ {
+ get => GetValue(IconProperty);
+ set => SetValue(IconProperty, value);
+ }
+
public static readonly DirectProperty CopyTextProperty =
AvaloniaProperty.RegisterDirect(
nameof(CopyText),
@@ -60,8 +69,7 @@ protected override void OnLoaded(RoutedEventArgs e)
{
base.OnLoaded(e);
- if (this.FindResource("Icons.Copy") is Geometry copyGeo)
- _copyIcon.Data = copyGeo;
+ _copyIcon.Data = Icon ?? this.FindResource("Icons.Copy") as Geometry;
if (this.FindResource("Icons.Check") is Geometry checkGeo)
_checkIcon.Data = checkGeo;
@@ -90,7 +98,11 @@ protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs chang
{
base.OnPropertyChanged(change);
- if (change.Property == IsCopiedProperty)
+ if (change.Property == IconProperty)
+ {
+ _copyIcon.Data = Icon ?? this.FindResource("Icons.Copy") as Geometry;
+ }
+ else if (change.Property == IsCopiedProperty)
{
_copyIcon.IsVisible = !_isCopied;
_checkIcon.IsVisible = _isCopied;
diff --git a/src/Views/RepositoryToolbar.axaml b/src/Views/RepositoryToolbar.axaml
index 08ed8e83c..9e02b9842 100644
--- a/src/Views/RepositoryToolbar.axaml
+++ b/src/Views/RepositoryToolbar.axaml
@@ -4,6 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:m="using:SourceGit.Models"
xmlns:vm="using:SourceGit.ViewModels"
+ xmlns:v="using:SourceGit.Views"
xmlns:c="using:SourceGit.Converters"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SourceGit.Views.RepositoryToolbar"
@@ -128,13 +129,17 @@
-
+