fix: v0.0.55 - use pad3 for percentage display

- Percentages max at 3 chars (100), pad4 gives one too many dashes
This commit is contained in:
Troed Sångberg
2026-06-14 08:41:05 +02:00
parent b54d609934
commit c629cd3536
2 changed files with 7 additions and 2 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@troed/oc-ls-stats",
"version": "0.0.54",
"version": "0.0.55",
"type": "module",
"exports": {
"./tui": {
+6 -1
View File
@@ -206,6 +206,11 @@ function pad4(s: string | undefined) {
return s.padStart(4, " ")
}
function pad3(s: string | undefined) {
if (!s) return "---"
return s.padStart(3, " ")
}
function activeDurationMs(samples: StreamSample[], tailAt?: number) {
if (samples.length === 0) return 0
if (samples.length === 1) {
@@ -261,7 +266,7 @@ function SessionPromptRight(props: {
const pp = prefillRate()
const tps = liveTps()
const progress = prefillProgress()
const ppLabel = pp ? `PP ${pad4(formatPps(pp))} tps (${pad4(formatPercent(progress))}%)` : `PP ${pad4(undefined)} tps (${pad4(undefined)}%)`
const ppLabel = pp ? `PP ${pad4(formatPps(pp))} tps (${pad3(formatPercent(progress))}%)` : `PP ${pad4(undefined)} tps (${pad3(undefined)}%)`
const tpsLabel = tps ? `GEN ${pad4(formatTps(tps))} tps` : `GEN ${pad4(undefined)} tps`
return `${ppLabel} | ${tpsLabel}`
})