mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:57:34 +00:00
man: Center "SerenityOS manual" title
This patch calculates how many spaces are needed to center the top title of "SerenityOS manual".
This commit is contained in:
parent
246c31ccf6
commit
19b7a5fe0d
1 changed files with 10 additions and 2 deletions
|
@ -116,13 +116,21 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto buffer = file->read_all();
|
||||
auto source = String::copy(buffer);
|
||||
|
||||
outln("{}({})\t\tSerenityOS manual", name, section);
|
||||
const String title("SerenityOS manual");
|
||||
|
||||
int spaces = view_width / 2 - String(name).length() - String(section).length() - title.length() / 2 - 4;
|
||||
if (spaces < 0)
|
||||
spaces = 0;
|
||||
out("{}({})", name, section);
|
||||
while (spaces--)
|
||||
out(" ");
|
||||
outln(title);
|
||||
|
||||
auto document = Markdown::Document::parse(source);
|
||||
VERIFY(document);
|
||||
|
||||
String rendered = document->render_for_terminal(view_width);
|
||||
out("{}", rendered);
|
||||
outln("{}", rendered);
|
||||
|
||||
// FIXME: Remove this wait, it shouldn't be necessary but Shell does not
|
||||
// resume properly without it. This wait also breaks <C-z> backgrounding
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue