mirror of
				https://github.com/nsnail/spectre.console.git
				synced 2025-11-04 10:35:27 +08:00 
			
		
		
		
	Updating test and Ratio calculation
This commit is contained in:
		@@ -9,7 +9,17 @@ internal static class Ratio
 | 
			
		||||
    {
 | 
			
		||||
        static (int Div, float Mod) DivMod(float x, float y)
 | 
			
		||||
        {
 | 
			
		||||
            return ((int)(x / y), x % y);
 | 
			
		||||
            var (div, mod) = ((int)(x / y), x % y);
 | 
			
		||||
 | 
			
		||||
            // If remainder is withing .0001 of 1 then we round up
 | 
			
		||||
            if (!(mod > 0.9999))
 | 
			
		||||
            {
 | 
			
		||||
                return (div, mod);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            div++;
 | 
			
		||||
            mod = 0;
 | 
			
		||||
            return (div, mod);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        static int? GetEdgeWidth(IRatioResolvable edge)
 | 
			
		||||
@@ -46,7 +56,8 @@ internal static class Ratio
 | 
			
		||||
                    .ToList();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            var portion = (float)remaining / flexibleEdges.Sum(x => Math.Max(1, x.Edge.Ratio));
 | 
			
		||||
            var r = flexibleEdges.Sum(x => Math.Max(1, x.Edge.Ratio));
 | 
			
		||||
            var portion = (float)remaining / r;
 | 
			
		||||
 | 
			
		||||
            var invalidate = false;
 | 
			
		||||
            foreach (var (index, size, edge) in flexibleEdges)
 | 
			
		||||
 
 | 
			
		||||
@@ -463,8 +463,14 @@ public class Segment
 | 
			
		||||
        var result = new List<Segment>();
 | 
			
		||||
 | 
			
		||||
        var segmentBuilder = (SegmentBuilder?)null;
 | 
			
		||||
        var c = 0;
 | 
			
		||||
        foreach (var segment in segments)
 | 
			
		||||
        {
 | 
			
		||||
            if (c == 163)
 | 
			
		||||
            {
 | 
			
		||||
                System.Console.Write("test");
 | 
			
		||||
            }
 | 
			
		||||
            c++;
 | 
			
		||||
            if (segmentBuilder == null)
 | 
			
		||||
            {
 | 
			
		||||
                segmentBuilder = new SegmentBuilder(segment);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user