Merge pull request #2553 from MartinFournier/fix/mem-padding

Fix mem padding when using GiB
This commit is contained in:
hydroflame 2022-01-11 11:13:04 -05:00 committed by GitHub
commit 2b3b460588
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3,6 +3,7 @@ import { IRouter } from "../../ui/Router";
import { IPlayer } from "../../PersonObjects/IPlayer"; import { IPlayer } from "../../PersonObjects/IPlayer";
import { BaseServer } from "../../Server/BaseServer"; import { BaseServer } from "../../Server/BaseServer";
import { numeralWrapper } from "../../ui/numeralFormat"; import { numeralWrapper } from "../../ui/numeralFormat";
import { Settings } from "../../Settings/Settings";
export function mem( export function mem(
terminal: ITerminal, terminal: ITerminal,
@ -40,8 +41,9 @@ export function mem(
); );
const verboseEntries = script.ramUsageEntries?.sort((a, b) => b.cost - a.cost) ?? []; const verboseEntries = script.ramUsageEntries?.sort((a, b) => b.cost - a.cost) ?? [];
const padding = Settings.UseIEC60027_2 ? 9 : 8;
for (const entry of verboseEntries) { for (const entry of verboseEntries) {
terminal.print(`${numeralWrapper.formatRAM(entry.cost * numThreads).padStart(8)} | ${entry.name} (${entry.type})`); terminal.print(`${numeralWrapper.formatRAM(entry.cost * numThreads).padStart(padding)} | ${entry.name} (${entry.type})`);
} }
if (ramUsage > 0 && verboseEntries.length === 0) { if (ramUsage > 0 && verboseEntries.length === 0) {