fix: make footer token counts more compact

- Use M suffix for millions (e.g., 10.2M instead of 10184k)
- Change '% of' to '%/' for context display
This commit is contained in:
Mario Zechner 2025-12-05 12:21:44 +01:00
parent 6a29b2df3f
commit 5c388c0a77

View file

@ -145,7 +145,9 @@ export class FooterComponent implements Component {
const formatTokens = (count: number): string => {
if (count < 1000) return count.toString();
if (count < 10000) return (count / 1000).toFixed(1) + "k";
return Math.round(count / 1000) + "k";
if (count < 1000000) return Math.round(count / 1000) + "k";
if (count < 10000000) return (count / 1000000).toFixed(1) + "M";
return Math.round(count / 1000000) + "M";
};
// Replace home directory with ~
@ -186,7 +188,7 @@ 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}`;
const contextPercentDisplay = `${contextPercent}%/${formatTokens(contextWindow)}${autoIndicator}`;
if (contextPercentValue > 90) {
contextPercentStr = theme.fg("error", contextPercentDisplay);
} else if (contextPercentValue > 70) {