mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-23 08:00:20 +00:00
LibMarkdown: Convert StringBuilder::appendf() => AK::Format
These are the last ones in the codebase. :^)
This commit is contained in:
parent
32080452e3
commit
730ed465fe
Notes:
sideshowbarker
2024-07-18 18:35:01 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/730ed465fe7
1 changed files with 6 additions and 2 deletions
|
@ -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)));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue