Browse Source

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

Andreas Kling 4 years ago
parent
commit
90ee84621f

+ 5 - 5
Userland/Libraries/LibLine/Editor.cpp

@@ -1467,9 +1467,9 @@ String Style::Background::to_vt_escape() const
         return "";
         return "";
 
 
     if (m_is_rgb) {
     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 {
     } 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 "";
         return "";
 
 
     if (m_is_rgb) {
     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 {
     } 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())
     if (is_empty())
         return "";
         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)
 void Style::unify_with(const Style& other, bool prefer_other)

+ 1 - 1
Userland/Libraries/LibLine/XtermSuggestionDisplay.cpp

@@ -155,7 +155,7 @@ void XtermSuggestionDisplay::display(const SuggestionManager& manager)
     if (m_pages.size() > 1) {
     if (m_pages.size() > 1) {
         auto left_arrow = page_index > 0 ? '<' : ' ';
         auto left_arrow = page_index > 0 ? '<' : ' ';
         auto right_arrow = page_index < m_pages.size() - 1 ? '>' : ' ';
         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) {
         if (string.length() > m_num_columns - 1) {
             // This would overflow into the next line, so just don't print an indicator.
             // This would overflow into the next line, so just don't print an indicator.