LibLine: Convert String::format() => String::formatted()

This commit is contained in:
Andreas Kling 2021-04-21 22:45:45 +02:00
parent 4e6d2374b6
commit 90ee84621f
Notes: sideshowbarker 2024-07-18 19:16:08 +09:00
2 changed files with 6 additions and 6 deletions

View file

@ -1467,9 +1467,9 @@ String Style::Background::to_vt_escape() const
return "";
if (m_is_rgb) {
return String::format("\033[48;2;%d;%d;%dm", m_rgb_color[0], m_rgb_color[1], m_rgb_color[2]);
return String::formatted("\e[48;2;{};{};{}m", m_rgb_color[0], m_rgb_color[1], m_rgb_color[2]);
} else {
return String::format("\033[%dm", (u8)m_xterm_color + 40);
return String::formatted("\e[{}m", (u8)m_xterm_color + 40);
}
}
@ -1479,9 +1479,9 @@ String Style::Foreground::to_vt_escape() const
return "";
if (m_is_rgb) {
return String::format("\033[38;2;%d;%d;%dm", m_rgb_color[0], m_rgb_color[1], m_rgb_color[2]);
return String::formatted("\e[38;2;{};{};{}m", m_rgb_color[0], m_rgb_color[1], m_rgb_color[2]);
} else {
return String::format("\033[%dm", (u8)m_xterm_color + 30);
return String::formatted("\e[{}m", (u8)m_xterm_color + 30);
}
}
@ -1490,7 +1490,7 @@ String Style::Hyperlink::to_vt_escape(bool starting) const
if (is_empty())
return "";
return String::format("\033]8;;%s\033\\", starting ? m_link.characters() : "");
return String::formatted("\e]8;;{}\e\\", starting ? m_link : String::empty());
}
void Style::unify_with(const Style& other, bool prefer_other)

View file

@ -155,7 +155,7 @@ void XtermSuggestionDisplay::display(const SuggestionManager& manager)
if (m_pages.size() > 1) {
auto left_arrow = page_index > 0 ? '<' : ' ';
auto right_arrow = page_index < m_pages.size() - 1 ? '>' : ' ';
auto string = String::format("%c page %zu of %zu %c", left_arrow, page_index + 1, m_pages.size(), right_arrow);
auto string = String::formatted("{:c} page {} of {} {:c}", left_arrow, page_index + 1, m_pages.size(), right_arrow);
if (string.length() > m_num_columns - 1) {
// This would overflow into the next line, so just don't print an indicator.