fix stats formatting again on export option

This commit is contained in:
2026-05-20 11:56:02 +02:00
parent 47b57b5d3c
commit a71ee8b81d
2 changed files with 17 additions and 22 deletions
Binary file not shown.
+17 -22
View File
@@ -99,32 +99,27 @@ public static class StatsPanel
/// </summary>
private static IRenderable BuildBarRow(string label, double pct, int barWidth)
{
var filled = (int)Math.Round(pct / 100.0 * barWidth);
filled = Math.Clamp(filled, 0, barWidth);
var empty = barWidth - filled;
var filled = (int)Math.Round(pct / 100.0 * barWidth);
filled = Math.Clamp(filled, 0, barWidth);
var empty = barWidth - filled;
var filledColor = CpuColor(pct);
var filledStr = new string('\u2588', filled);
var emptyStr = new string('\u2591', empty);
var filledColor = CpuColor(pct);
var filledStr = new string('\u2588', filled);
var emptyStr = new string('\u2591', empty);
var row = new Grid();
row.AddColumn(new GridColumn().NoWrap().Width(9)); // label
row.AddColumn(new GridColumn().NoWrap()); // bar chars
row.AddColumn(new GridColumn().NoWrap().Width(7)); // pct
var row = new Grid();
var colorMarkup = filledColor.ToMarkup();
row.AddRow(
new Text($" {label,-5}", new Style(Color.Grey, decoration: Decoration.Dim)),
// Bar: colored filled + dim empty, wrapped in plain Text objects side by side
new Columns(
new Text("[", new Style(Color.Grey)),
new Text(filledStr, new Style(filledColor)),
new Text(emptyStr, new Style(Color.Grey, decoration: Decoration.Dim)),
new Text("]", new Style(Color.Grey))
),
new Text($" {pct,5:F1}%", new Style(Color.White, decoration: Decoration.Bold))
);
// Construct a seamless markup string
var barMarkup = $"[grey][[[/][{colorMarkup}]{filledStr}[/][grey dim]{emptyStr}[/][grey]]][/]";
return row;
row.AddRow(
new Text($" {label,-5}", new Style(Color.Grey, decoration: Decoration.Dim)),
new Markup(barMarkup), // Replace Columns with a single Markup object
new Text($" {pct,5:F1}%", new Style(Color.White, decoration: Decoration.Bold))
);
return row;
}
private static Color CpuColor(double pct) => pct switch