mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:27:45 +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
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();
|
auto string = text.render_for_terminal();
|
||||||
if (alignment == Alignment::Center) {
|
if (alignment == Alignment::Center) {
|
||||||
auto padding_length = (width - original_length) / 2;
|
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)
|
if ((width - original_length) % 2)
|
||||||
builder.append(' ');
|
builder.append(' ');
|
||||||
} else {
|
} 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…
Add table
Add a link
Reference in a new issue