From 7ab8f8ab435eab24cdb05a9832f05100760ced38 Mon Sep 17 00:00:00 2001 From: Corentin Damman Date: Wed, 8 Oct 2025 08:16:20 +0200 Subject: [PATCH 1/5] ux: resize logs view --- src/Views/ViewLogs.axaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Views/ViewLogs.axaml b/src/Views/ViewLogs.axaml index bba5da8eb..f77e9856a 100644 --- a/src/Views/ViewLogs.axaml +++ b/src/Views/ViewLogs.axaml @@ -5,15 +5,16 @@ xmlns:vm="using:SourceGit.ViewModels" xmlns:v="using:SourceGit.Views" xmlns:c="using:SourceGit.Converters" - mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" + mc:Ignorable="d" d:DesignWidth="1200" d:DesignHeight="600" x:Class="SourceGit.Views.ViewLogs" x:DataType="vm:ViewLogs" x:Name="ThisControl" Title="{DynamicResource Text.ViewLogs}" Icon="/App.ico" - Width="800" Height="500" + Width="1200" Height="600" CanResize="True" - WindowStartupLocation="CenterOwner"> + WindowStartupLocation="CenterOwner" + Loaded="OnLoaded"> From b0c84542e1be1e4815b69f850bff67ded00a14ae Mon Sep 17 00:00:00 2001 From: Corentin Damman Date: Wed, 8 Oct 2025 08:18:23 +0200 Subject: [PATCH 2/5] ux: allow hyperlinks in logs view This is needed to be able to click on pull request links --- src/Views/CommandLogContentPresenter.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Views/CommandLogContentPresenter.cs b/src/Views/CommandLogContentPresenter.cs index 637a592f0..10741ec98 100644 --- a/src/Views/CommandLogContentPresenter.cs +++ b/src/Views/CommandLogContentPresenter.cs @@ -91,8 +91,9 @@ public string PureText VerticalScrollBarVisibility = ScrollBarVisibility.Auto; TextArea.TextView.Margin = new Thickness(4, 0); - TextArea.TextView.Options.EnableHyperlinks = false; - TextArea.TextView.Options.EnableEmailHyperlinks = false; + TextArea.TextView.Options.EnableHyperlinks = true; + TextArea.TextView.Options.EnableEmailHyperlinks = true; + TextArea.TextView.Options.RequireControlModifierForHyperlinkClick = false; } public void OnReceiveCommandLog(string line) From 53b1a2f80b6d96e0e25f79d64b53167b8be2acab Mon Sep 17 00:00:00 2001 From: Corentin Damman Date: Wed, 8 Oct 2025 08:18:47 +0200 Subject: [PATCH 3/5] ux: fix logs view scrollbar dimensions --- src/Views/CommandLogContentPresenter.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Views/CommandLogContentPresenter.cs b/src/Views/CommandLogContentPresenter.cs index 10741ec98..d03660c22 100644 --- a/src/Views/CommandLogContentPresenter.cs +++ b/src/Views/CommandLogContentPresenter.cs @@ -94,6 +94,7 @@ public string PureText TextArea.TextView.Options.EnableHyperlinks = true; TextArea.TextView.Options.EnableEmailHyperlinks = true; TextArea.TextView.Options.RequireControlModifierForHyperlinkClick = false; + TextArea.TextView.Options.AllowScrollBelowDocument = false; } public void OnReceiveCommandLog(string line) From f00b159ca3b9320a77c80a4397c91122335af8cf Mon Sep 17 00:00:00 2001 From: Corentin Damman Date: Wed, 8 Oct 2025 08:16:41 +0200 Subject: [PATCH 4/5] feature: automatically select latest log in logs view --- src/Views/ViewLogs.axaml.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Views/ViewLogs.axaml.cs b/src/Views/ViewLogs.axaml.cs index b88147d36..a6214e575 100644 --- a/src/Views/ViewLogs.axaml.cs +++ b/src/Views/ViewLogs.axaml.cs @@ -1,5 +1,6 @@ using Avalonia.Controls; using Avalonia.Input; +using Avalonia.Interactivity; namespace SourceGit.Views { @@ -11,6 +12,12 @@ public ViewLogs() InitializeComponent(); } + private void OnLoaded(object sender, RoutedEventArgs e) + { + if (DataContext is ViewModels.ViewLogs vm && vm.Logs.Count > 0) + vm.SelectedLog = vm.Logs[0]; + } + private void OnLogContextRequested(object sender, ContextRequestedEventArgs e) { if (sender is not Grid { DataContext: ViewModels.CommandLog log } grid || DataContext is not ViewModels.ViewLogs vm) From aef836749bff3a737663cb5e11e0053f61e25840 Mon Sep 17 00:00:00 2001 From: Corentin Damman Date: Wed, 8 Oct 2025 08:19:01 +0200 Subject: [PATCH 5/5] feature: automatically scroll to the end of the log --- src/Views/CommandLogContentPresenter.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Views/CommandLogContentPresenter.cs b/src/Views/CommandLogContentPresenter.cs index d03660c22..8aaa3df9d 100644 --- a/src/Views/CommandLogContentPresenter.cs +++ b/src/Views/CommandLogContentPresenter.cs @@ -146,11 +146,15 @@ protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs chang { Text = string.Empty; } + ScrollToEnd(); } else if (change.Property == PureTextProperty) { if (!string.IsNullOrEmpty(PureText)) + { Text = PureText; + ScrollToEnd(); + } } }