diff --git a/src/utils/history.ts b/src/utils/history.ts index aaedee3..bc126a7 100644 --- a/src/utils/history.ts +++ b/src/utils/history.ts @@ -3,10 +3,14 @@ const history: History = {}; let historyIndex = 0; export function list(): string { + const maximumNumberOfDigits = historyIndex.toString().length; + const array: Array = []; for (const index in history) { - const value: string = history[index]; - array.push(`${index}: ${value}`); + const value = history[index]; + const paddedIndex = index.toString().padStart(maximumNumberOfDigits, ' '); + + array.push(`${paddedIndex}: ${value}`); } return array.join('\n');