X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fterminal_chat_console.cpp;h=9e3d33736190bc6ca2275d43b2ca84f37423c66a;hb=fd9f195fcc2e4e592dbad3290876486eb08318b2;hp=a8c4ebaef1a8926e559f06ae534567b46fe8c3f1;hpb=14ef2b445adcec770defe1abf83af9d22ccf39d8;p=minetest.git diff --git a/src/terminal_chat_console.cpp b/src/terminal_chat_console.cpp index a8c4ebaef..9e3d33736 100644 --- a/src/terminal_chat_console.cpp +++ b/src/terminal_chat_console.cpp @@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "settings.h" #include "util/numeric.h" #include "util/string.h" +#include "chat_interface.h" TerminalChatConsole g_term_console; @@ -347,7 +348,8 @@ void TerminalChatConsole::step(int ch) std::wstring error_message = utf8_to_wide(Logger::getLevelLabel(p.first)); if (!g_settings->getBool("disable_escape_sequences")) { - error_message = L"\x1b(c@red)" + error_message + L"\x1b(c@white)"; + error_message = std::wstring(L"\x1b(c@red)").append(error_message) + .append(L"\x1b(c@white)"); } m_chat_backend.addMessage(error_message, utf8_to_wide(p.second)); } @@ -438,8 +440,7 @@ void TerminalChatConsole::draw_text() const ChatFormattedLine& line = buf.getFormattedLine(row); if (line.fragments.empty()) continue; - for (u32 i = 0; i < line.fragments.size(); ++i) { - const ChatFormattedFragment& fragment = line.fragments[i]; + for (const ChatFormattedFragment &fragment : line.fragments) { addstr(wide_to_utf8(fragment.text.getString()).c_str()); } }