diff --git a/src/App.axaml b/src/App.axaml
index 186022d5..f4dc3d89 100644
--- a/src/App.axaml
+++ b/src/App.axaml
@@ -28,6 +28,7 @@
+
diff --git a/src/SourceGit.csproj b/src/SourceGit.csproj
index 5205ae4f..8d76934c 100644
--- a/src/SourceGit.csproj
+++ b/src/SourceGit.csproj
@@ -40,6 +40,7 @@
+
diff --git a/src/ViewModels/Histories.cs b/src/ViewModels/Histories.cs
index 75c5861d..479a20a1 100644
--- a/src/ViewModels/Histories.cs
+++ b/src/ViewModels/Histories.cs
@@ -300,7 +300,7 @@ namespace SourceGit.ViewModels
}
}
- public ContextMenu MakeContextMenu(ListBox list)
+ public ContextMenu MakeContextMenu(DataGrid list)
{
var current = _repo.CurrentBranch;
if (current == null || list.SelectedItems == null)
diff --git a/src/ViewModels/LayoutInfo.cs b/src/ViewModels/LayoutInfo.cs
index 37d6e784..f993e242 100644
--- a/src/ViewModels/LayoutInfo.cs
+++ b/src/ViewModels/LayoutInfo.cs
@@ -41,12 +41,6 @@ namespace SourceGit.ViewModels
set => SetProperty(ref _repositorySidebarWidth, value);
}
- public GridLength HistoriesAuthorColumnWidth
- {
- get => _historiesAuthorColumnWidth;
- set => SetProperty(ref _historiesAuthorColumnWidth, value);
- }
-
public GridLength WorkingCopyLeftWidth
{
get => _workingCopyLeftWidth;
@@ -72,7 +66,6 @@ namespace SourceGit.ViewModels
}
private GridLength _repositorySidebarWidth = new GridLength(250, GridUnitType.Pixel);
- private GridLength _historiesAuthorColumnWidth = new GridLength(120, GridUnitType.Pixel);
private GridLength _workingCopyLeftWidth = new GridLength(300, GridUnitType.Pixel);
private GridLength _stashesLeftWidth = new GridLength(300, GridUnitType.Pixel);
private GridLength _commitDetailChangesLeftWidth = new GridLength(256, GridUnitType.Pixel);
diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs
index 4a057398..09e5a27f 100644
--- a/src/ViewModels/Repository.cs
+++ b/src/ViewModels/Repository.cs
@@ -871,7 +871,7 @@ namespace SourceGit.ViewModels
Task.Run(() =>
{
- List visible = [];
+ var visible = new List();
var method = (Models.CommitSearchMethod)_searchCommitFilterType;
if (method == Models.CommitSearchMethod.BySHA)
@@ -880,8 +880,8 @@ namespace SourceGit.ViewModels
if (isCommitSHA)
{
var commit = new Commands.QuerySingleCommit(_fullpath, _searchCommitFilter).Result();
- visible = [commit];
- }
+ visible.Add(commit);
+ }
}
else
{
diff --git a/src/Views/CommitGraph.cs b/src/Views/CommitGraph.cs
index 5db39300..4f139f83 100644
--- a/src/Views/CommitGraph.cs
+++ b/src/Views/CommitGraph.cs
@@ -1,5 +1,6 @@
using Avalonia;
using Avalonia.Controls;
+using Avalonia.Controls.Primitives;
using Avalonia.Media;
using Avalonia.VisualTree;
@@ -51,26 +52,40 @@ namespace SourceGit.Views
if (histories == null)
return;
- var list = histories.CommitListContainer;
- if (list == null)
+ var grid = histories.CommitListContainer;
+ if (grid == null)
return;
- var container = list.ItemsPanelRoot as VirtualizingStackPanel;
- if (container == null)
+ var rowsPresenter = grid.FindDescendantOfType();
+ if (rowsPresenter == null)
return;
- var item = list.ContainerFromIndex(container.FirstRealizedIndex);
- if (item == null)
- return;
+ double rowHeight = grid.RowHeight;
+ double startY = 0;
+ foreach (var child in rowsPresenter.Children)
+ {
+ var row = child as DataGridRow;
+ if (row.IsVisible)
+ {
+ if (rowHeight != row.Bounds.Height)
+ rowHeight = row.Bounds.Height;
- var width = histories.CommitListHeader.ColumnDefinitions[0].ActualWidth;
- var height = Bounds.Height;
- var rowHeight = item.Bounds.Height;
- var startY = container.FirstRealizedIndex * rowHeight - item.TranslatePoint(new Point(0, 0), list).Value!.Y;
+ if (row.Bounds.Top <= 0 && row.Bounds.Top > -rowHeight)
+ {
+ var test = rowHeight * row.Index - row.Bounds.Top;
+ if (startY < test)
+ startY = test;
+ }
+ }
+ }
+
+ var headersHeight = grid.ColumnHeaderHeight;
+ var width = histories.CommitListContainer.Columns[0].ActualWidth;
+ var height = Bounds.Height - headersHeight;
var endY = startY + height + 28;
- using (context.PushClip(new Rect(0, 0, width, height)))
- using (context.PushTransform(Matrix.CreateTranslation(0, -startY)))
+ using (context.PushClip(new Rect(0, headersHeight, width, height)))
+ using (context.PushTransform(Matrix.CreateTranslation(0, headersHeight - startY)))
{
DrawCurves(context, graph, startY, endY, rowHeight);
DrawAnchors(context, graph, startY, endY, rowHeight);
diff --git a/src/Views/Histories.axaml b/src/Views/Histories.axaml
index 8d3c4e2b..bb92ff5c 100644
--- a/src/Views/Histories.axaml
+++ b/src/Views/Histories.axaml
@@ -24,202 +24,213 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
-
-
-
-
+
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ LinkForeground="{DynamicResource Brush.Link}"
+ Subject="{Binding Subject}"
+ IssueTrackerRules="{Binding $parent[v:Histories].IssueTrackerRules}"
+ FontWeight="{Binding FontWeight}"
+ Opacity="{Binding Opacity}"/>
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
diff --git a/src/Views/Histories.axaml.cs b/src/Views/Histories.axaml.cs
index 5ecebe49..3811500a 100644
--- a/src/Views/Histories.axaml.cs
+++ b/src/Views/Histories.axaml.cs
@@ -129,23 +129,16 @@ namespace SourceGit.Views
if (change.Property == NavigationIdProperty)
{
- if (DataContext is ViewModels.Histories)
- {
- var list = CommitListContainer;
- if (list is { SelectedItems.Count: 1 })
- list.ScrollIntoView(list.SelectedIndex);
- }
+ var list = CommitListContainer;
+ if (list is { SelectedItems.Count: 1 })
+ list.ScrollIntoView(list.SelectedItem, null);
}
}
private void OnCommitListLayoutUpdated(object _1, EventArgs _2)
{
- var y = CommitListContainer.Scroll?.Offset.Y ?? 0;
- var authorNameColumnWidth = ViewModels.Preferences.Instance.Layout.HistoriesAuthorColumnWidth.Value;
- if (y != _lastScrollY || authorNameColumnWidth != _lastAuthorNameColumnWidth)
+ if (IsLoaded)
{
- _lastScrollY = y;
- _lastAuthorNameColumnWidth = authorNameColumnWidth;
CommitGraph.InvalidateVisual();
}
}
@@ -161,7 +154,7 @@ namespace SourceGit.Views
private void OnCommitListContextRequested(object sender, ContextRequestedEventArgs e)
{
- if (DataContext is ViewModels.Histories histories && sender is ListBox { SelectedItems.Count: > 0 } list)
+ if (DataContext is ViewModels.Histories histories && sender is DataGrid { SelectedItems.Count: > 0 } list)
{
var menu = histories.MakeContextMenu(list);
menu?.Open(list);
@@ -175,7 +168,7 @@ namespace SourceGit.Views
return;
// These shortcuts are not mentioned in the Shortcut Reference window. Is this expected?
- if (sender is ListBox { SelectedItems: { Count: > 0 } selected })
+ if (sender is DataGrid { SelectedItems: { Count: > 0 } selected })
{
// CTRL/COMMAND + C -> Copy selected commit SHA and subject.
if (e.Key == Key.C)
@@ -212,13 +205,14 @@ namespace SourceGit.Views
}
}
- private void OnCommitListItemDoubleTapped(object sender, TappedEventArgs e)
+ private void OnCommitListDoubleTapped(object sender, TappedEventArgs e)
{
e.Handled = true;
if (DataContext is ViewModels.Histories histories &&
CommitListContainer.SelectedItems is { Count: 1 } &&
- sender is Grid { DataContext: Models.Commit commit })
+ sender is DataGrid grid &&
+ e.Source != grid)
{
if (e.Source is CommitRefsPresenter crp)
{
@@ -227,11 +221,9 @@ namespace SourceGit.Views
return;
}
- histories.CheckoutBranchByCommit(commit);
+ if (e.Source is Control { DataContext: Models.Commit c })
+ histories.CheckoutBranchByCommit(c);
}
}
-
- private double _lastScrollY = 0;
- private double _lastAuthorNameColumnWidth = 0;
}
}