From 69d37e0962e51a5e16cb1fd94f990327cc52822c Mon Sep 17 00:00:00 2001 From: Attacktive Date: Mon, 23 May 2022 13:38:11 +0900 Subject: [PATCH] Align text. --- src/utils/history.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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');