mirror of
https://github.com/ocornut/imgui.git
synced 2025-01-19 09:37:30 +01:00
Debug Log, Test Engine: avoid duplicate carriage return when using ImGuiDebugLogFlags_OutputToTestEngine. (#5855)
This commit is contained in:
parent
868f444620
commit
661c388515
@ -15568,8 +15568,11 @@ void ImGui::DebugLogV(const char* fmt, va_list args)
|
|||||||
if (g.DebugLogFlags & ImGuiDebugLogFlags_OutputToTTY)
|
if (g.DebugLogFlags & ImGuiDebugLogFlags_OutputToTTY)
|
||||||
IMGUI_DEBUG_PRINTF("%s", g.DebugLogBuf.begin() + old_size);
|
IMGUI_DEBUG_PRINTF("%s", g.DebugLogBuf.begin() + old_size);
|
||||||
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
||||||
|
// IMGUI_TEST_ENGINE_LOG() adds a trailing \n automatically
|
||||||
|
const int new_size = g.DebugLogBuf.size();
|
||||||
|
const bool trailing_carriage_return = (g.DebugLogBuf[new_size - 1] == '\n');
|
||||||
if (g.DebugLogFlags & ImGuiDebugLogFlags_OutputToTestEngine)
|
if (g.DebugLogFlags & ImGuiDebugLogFlags_OutputToTestEngine)
|
||||||
IMGUI_TEST_ENGINE_LOG("%s", g.DebugLogBuf.begin() + old_size);
|
IMGUI_TEST_ENGINE_LOG("%.*s", new_size - old_size - (trailing_carriage_return ? 1 : 0), g.DebugLogBuf.begin() + old_size);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user