diff options
author | Andreas Kling <kling@serenityos.org> | 2021-05-07 21:08:37 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-07 21:12:09 +0200 |
commit | 730ed465fe785ae82fe4f4cfb24350f1869bae2a (patch) | |
tree | 28233234afb6681587200e710394e13473c74f4b /Userland/Libraries/LibMarkdown/Table.cpp | |
parent | 32080452e355535754f0916e5cf586750ccdfa37 (diff) | |
download | serenity-730ed465fe785ae82fe4f4cfb24350f1869bae2a.zip |
LibMarkdown: Convert StringBuilder::appendf() => AK::Format
These are the last ones in the codebase. :^)
Diffstat (limited to 'Userland/Libraries/LibMarkdown/Table.cpp')
-rw-r--r-- | Userland/Libraries/LibMarkdown/Table.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Userland/Libraries/LibMarkdown/Table.cpp b/Userland/Libraries/LibMarkdown/Table.cpp index c80d103ec4..6c08723123 100644 --- a/Userland/Libraries/LibMarkdown/Table.cpp +++ b/Userland/Libraries/LibMarkdown/Table.cpp @@ -22,11 +22,15 @@ String Table::render_for_terminal(size_t view_width) const auto string = text.render_for_terminal(); if (alignment == Alignment::Center) { auto padding_length = (width - original_length) / 2; - builder.appendf("%*s%s%*s", (int)padding_length, "", string.characters(), (int)padding_length, ""); + // FIXME: We're using a StringView literal to bypass the compile-time AK::Format checking here, since it can't handle the "}}" + builder.appendff("{:{1}}"sv, "", (int)padding_length); + builder.append(string); + builder.appendff("{:{1}}"sv, "", (int)padding_length); if ((width - original_length) % 2) builder.append(' '); } else { - builder.appendf(alignment == Alignment::Left ? "%-*s" : "%*s", (int)(width + (string.length() - original_length)), string.characters()); + // FIXME: We're using StringView literals to bypass the compile-time AK::Format checking here, since it can't handle the "}}" + builder.appendff(alignment == Alignment::Left ? "{:<{1}}"sv : "{:>{1}}"sv, string, (int)(width + (string.length() - original_length))); } }; |