mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-19 21:13:05 +01:00
Fix logging of replay info to stdout (#14430)
Use Console::WriteLine and replace \n with \r\n.
This commit is contained in:
@@ -134,7 +134,23 @@ void StdInOutConsole::WriteLine(const std::string& s, FormatToken colourFormat)
|
||||
{
|
||||
if (_isPromptShowing)
|
||||
{
|
||||
std::printf("\r%s%s\x1b[0m\x1b[0K\r\n", formatBegin.c_str(), s.c_str());
|
||||
auto* mainString = s.c_str();
|
||||
|
||||
// If string contains \n, we need to replace with \r\n
|
||||
std::string newString;
|
||||
if (s.find('\n') != std::string::npos)
|
||||
{
|
||||
for (auto ch : s)
|
||||
{
|
||||
if (ch == '\n')
|
||||
newString += "\r\n";
|
||||
else
|
||||
newString += ch;
|
||||
}
|
||||
mainString = newString.c_str();
|
||||
}
|
||||
|
||||
std::printf("\r%s%s\x1b[0m\x1b[0K\r\n", formatBegin.c_str(), mainString);
|
||||
std::fflush(stdout);
|
||||
linenoise::linenoiseEditRefreshLine();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user