improve readability of context usage display calculation (#111)

This commit is contained in:
Markus Ylisiurunen 2025-12-05 02:38:31 +02:00 committed by GitHub
parent e1d3c2b76e
commit 488f080883
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -186,12 +186,13 @@ export class FooterComponent implements Component {
// Colorize context percentage based on usage
let contextPercentStr: string;
const autoIndicator = this.autoCompactEnabled ? " (auto)" : "";
const contextPercentDisplay = `${contextPercent}% of ${formatTokens(contextWindow)}${autoIndicator}`;
if (contextPercentValue > 90) {
contextPercentStr = theme.fg("error", `${contextPercent}%${autoIndicator}`);
contextPercentStr = theme.fg("error", contextPercentDisplay);
} else if (contextPercentValue > 70) {
contextPercentStr = theme.fg("warning", `${contextPercent}%${autoIndicator}`);
contextPercentStr = theme.fg("warning", contextPercentDisplay);
} else {
contextPercentStr = `${contextPercent}%${autoIndicator}`;
contextPercentStr = contextPercentDisplay;
}
statsParts.push(contextPercentStr);