From 905f2ca1528211af91c8b5148fe66e349a901477 Mon Sep 17 00:00:00 2001 From: Karol Baraniecki Date: Sat, 4 Mar 2023 00:01:42 +0100 Subject: [PATCH] cal: Center the month-year text For now this only has an effect when displaying two-digit years, but when month names get implemented this will be helpful. --- Userland/Utilities/cal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Utilities/cal.cpp b/Userland/Utilities/cal.cpp index 7340d6cd0d9..43ffe1da798 100644 --- a/Userland/Utilities/cal.cpp +++ b/Userland/Utilities/cal.cpp @@ -29,7 +29,7 @@ static ErrorOr> month_lines_to_print(int month, int year) Vector lines; // FIXME: Both the month name and month header text should be provided by a locale - TRY(lines.try_append(TRY(String::formatted(" {:02} - {:02} ", month, year)))); + TRY(lines.try_append(TRY(String::formatted("{:^20s}", TRY(String::formatted("{:02} - {:02}", month, year)))))); TRY(lines.try_append(TRY(String::from_utf8("Su Mo Tu We Th Fr Sa"sv)))); int day_to_print = 1;