Skip to content

Commit

Permalink
Do not straighten if (expecting) too many lanes
Browse files Browse the repository at this point in the history
  • Loading branch information
mstv committed Mar 26, 2021
1 parent 23c37d9 commit db99fe5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace GitUI.UserControls.RevisionGrid.Columns
{
internal sealed class RevisionGraphColumnProvider : ColumnProvider
{
private const int MaxLanes = 40;
private const int MaxLanes = RevisionGraph.MaxLanes;

private static readonly int LaneLineWidth = DpiUtil.Scale(2);
private static readonly int LaneWidth = DpiUtil.Scale(16);
Expand Down
9 changes: 8 additions & 1 deletion GitUI/UserControls/RevisionGrid/Graph/RevisionGraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ internal interface IRevisionGraphRowProvider
// The RevisionGraph contains all the basic structures needed to render the graph.
public class RevisionGraph : IRevisionGraphRowProvider
{
public const int MaxLanes = 40;
private const int _straightenLanesLookAhead = 1;

// Some unordered collections with raw data
Expand Down Expand Up @@ -342,9 +343,15 @@ static void StraightenLanes(int startIndex, int lastIndex, IList<RevisionGraphRo
startIndex = Math.Max(1, startIndex);
for (int currentIndex = startIndex; currentIndex < lastIndex;)
{
IRevisionGraphRow currentRow = localOrderedRowCache[currentIndex];
if (currentRow.Segments.Count >= MaxLanes)
{
++currentIndex;
continue;
}

bool moved = false;
IRevisionGraphRow previousRow = localOrderedRowCache[currentIndex - 1];
IRevisionGraphRow currentRow = localOrderedRowCache[currentIndex];
IRevisionGraphRow nextRow = localOrderedRowCache[currentIndex + 1];
foreach (RevisionGraphSegment revisionGraphSegment in currentRow.Segments)
{
Expand Down

0 comments on commit db99fe5

Please sign in to comment.