diff --git a/src/Models/Stash.cs b/src/Models/Stash.cs index 369ab145..2b77be50 100644 --- a/src/Models/Stash.cs +++ b/src/Models/Stash.cs @@ -11,6 +11,24 @@ namespace SourceGit.Models public ulong Time { get; set; } = 0; public string Message { get; set; } = ""; - public string TimeStr => DateTime.UnixEpoch.AddSeconds(Time).ToLocalTime().ToString(DateTimeFormat.Active.DateTime); + public string Subject + { + get + { + var idx = Message.IndexOf('\n', StringComparison.Ordinal); + return idx > 0 ? Message.Substring(0, idx).Trim() : Message; + } + } + + public string TimeStr + { + get + { + return DateTime.UnixEpoch + .AddSeconds(Time) + .ToLocalTime() + .ToString(DateTimeFormat.Active.DateTime); + } + } } } diff --git a/src/Views/ApplyStash.axaml b/src/Views/ApplyStash.axaml index 505e7662..ded0e9f2 100644 --- a/src/Views/ApplyStash.axaml +++ b/src/Views/ApplyStash.axaml @@ -15,14 +15,16 @@ HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,8,0" Text="{DynamicResource Text.ApplyStash.Stash}"/> - - + - - - + + + - - + - - - + + + diff --git a/src/Views/StashSubjectPresenter.cs b/src/Views/StashSubjectPresenter.cs index 047e2483..727ee2fd 100644 --- a/src/Views/StashSubjectPresenter.cs +++ b/src/Views/StashSubjectPresenter.cs @@ -46,26 +46,23 @@ namespace SourceGit.Views set => SetValue(PrefixBackgroundProperty, value); } - public static readonly StyledProperty MessageProperty = - AvaloniaProperty.Register(nameof(Message)); + public static readonly StyledProperty SubjectProperty = + AvaloniaProperty.Register(nameof(Subject)); - public string Message + public string Subject { - get => GetValue(MessageProperty); - set => SetValue(MessageProperty, value); + get => GetValue(SubjectProperty); + set => SetValue(SubjectProperty, value); } public override void Render(DrawingContext context) { base.Render(context); - var message = Message ?? string.Empty; - if (string.IsNullOrEmpty(message)) + var subject = Subject; + if (string.IsNullOrEmpty(subject)) return; - var subjectIdx = message.IndexOf('\n', StringComparison.Ordinal); - var subject = subjectIdx > 0 ? message.Substring(0, subjectIdx).Trim() : message; - var typeface = new Typeface(FontFamily, FontStyle.Normal, FontWeight.Normal); var foreground = Foreground; var x = 0.0; @@ -108,7 +105,7 @@ namespace SourceGit.Views { base.OnPropertyChanged(change); - if (change.Property == MessageProperty || + if (change.Property == SubjectProperty || change.Property == FontFamilyProperty || change.Property == FontSizeProperty || change.Property == ForegroundProperty || diff --git a/src/Views/StashesPage.axaml b/src/Views/StashesPage.axaml index f5aa6ddd..1c3e2e50 100644 --- a/src/Views/StashesPage.axaml +++ b/src/Views/StashesPage.axaml @@ -96,7 +96,7 @@