From 0787241cdc61bd2169f4d7e236fe37e9f85960c0 Mon Sep 17 00:00:00 2001 From: ronak69 Date: Fri, 4 Aug 2023 06:23:24 +0000 Subject: [PATCH] Utilities: Fix title formatting in `man` `String::repeated()` returns a `ErrorOr`, so wrap it in `TRY()`. This fixes a glitch in the title formatting (`{}` not removed if `ErrorOr` is directly passed to `outln()`). --- Userland/Utilities/man.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Utilities/man.cpp b/Userland/Utilities/man.cpp index e6a51b01a6..07df56d3f1 100644 --- a/Userland/Utilities/man.cpp +++ b/Userland/Utilities/man.cpp @@ -98,7 +98,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto const title = "SerenityOS manual"_string; int spaces = max(view_width / 2 - page_name.code_points().length() - section_number.code_points().length() - title.code_points().length() / 2 - 4, 0); - outln("{}({}){}{}", page_name, section_number, String::repeated(' ', spaces), title); + outln("{}({}){}{}", page_name, section_number, TRY(String::repeated(' ', spaces)), title); auto document = Markdown::Document::parse(buffer); VERIFY(document);