@@ -16,8 +16,7 @@ internal sealed class NodesFrame
1616{
1717 private const int MaxColumn = 120 ;
1818
19- private readonly NodeStatus [ ] _nodes ;
20- private readonly int [ ] _durationLength ;
19+ private readonly ( NodeStatus nodeStatus , int durationLength ) [ ] _nodes ;
2120
2221 private readonly StringBuilder _renderBuilder = new ( ) ;
2322
@@ -30,27 +29,26 @@ public NodesFrame(NodeStatus?[] nodes, int width, int height)
3029 Width = Math . Min ( width , MaxColumn ) ;
3130 Height = height ;
3231
33- _nodes = new NodeStatus [ nodes . Length ] ;
34- _durationLength = new int [ nodes . Length ] ;
32+ _nodes = new ( NodeStatus , int ) [ nodes . Length ] ;
3533
3634 foreach ( NodeStatus ? status in nodes )
3735 {
3836 if ( status is not null )
3937 {
40- _nodes [ NodesCount ++ ] = status ;
38+ _nodes [ NodesCount ++ ] . nodeStatus = status ;
4139 }
4240 }
4341 }
4442
4543 internal ReadOnlySpan < char > RenderNodeStatus ( int i )
4644 {
47- NodeStatus status = _nodes [ i ] ;
45+ NodeStatus status = _nodes [ i ] . nodeStatus ;
4846
4947 string durationString = ResourceUtilities . FormatResourceStringIgnoreCodeAndKeyword (
5048 "DurationDisplay" ,
5149 status . Stopwatch . ElapsedSeconds ) ;
5250
53- _durationLength [ i ] = durationString . Length ;
51+ _nodes [ i ] . durationLength = durationString . Length ;
5452
5553 string project = status . Project ;
5654 string ? targetFramework = status . TargetFramework ;
@@ -102,10 +100,10 @@ public string Render(NodesFrame previousFrame)
102100 // Do we have previous node string to compare with?
103101 if ( previousFrame . NodesCount > i )
104102 {
105- if ( previousFrame . _nodes [ i ] == _nodes [ i ] && // Same everything except time, AND
106- previousFrame . _durationLength [ i ] == _durationLength [ i ] ) // same number of digits in time
103+ if ( previousFrame . _nodes [ i ] == _nodes [ i ] )
107104 {
108- string durationString = ResourceUtilities . FormatResourceStringIgnoreCodeAndKeyword ( "DurationDisplay" , _nodes [ i ] . Stopwatch . ElapsedSeconds ) ;
105+ // Same everything except time, AND same number of digits in time
106+ string durationString = ResourceUtilities . FormatResourceStringIgnoreCodeAndKeyword ( "DurationDisplay" , _nodes [ i ] . nodeStatus . Stopwatch . ElapsedSeconds ) ;
109107 sb . Append ( $ "{ AnsiCodes . SetCursorHorizontal ( MaxColumn ) } { AnsiCodes . MoveCursorBackward ( durationString . Length ) } { durationString } ") ;
110108 }
111109 else
0 commit comments