Browse Source

Debug Tools: Debug Log: Hide its own clipper log to reduce noise in the output.

pull/7175/head
ocornut 11 months ago
parent
commit
1e1013085b
  1. 1
      docs/CHANGELOG.txt
  2. 10
      imgui.cpp

1
docs/CHANGELOG.txt

@ -76,6 +76,7 @@ Other changes:
- Menus: Tweaked hover slack logic, adding a timer to avoid situations where a slow vertical
movements toward another parent BeginMenu() can keep the wrong child menu open. (#6671, #6926)
- Debug Tools: Added DebugFlashStyleColor() to identify a style color. Added to Style Editor.
- Debug Tools: Debug Log: Hide its own clipper log to reduce noise in the output.
- Misc: Added IMGUI_USER_H_FILENAME to change the path included when using
IMGUI_INCLUDE_IMGUI_USER_H. (#7039) [@bryceberger]
- Misc: Rework debug display of texture id in Metrics window to avoid compile-error when

10
imgui.cpp

@ -4787,7 +4787,7 @@ void ImGui::NewFrame()
g.DebugLocateId = 0;
if (g.DebugLogClipperAutoDisableFrames > 0 && --g.DebugLogClipperAutoDisableFrames == 0)
{
DebugLog("(Auto-disabled ImGuiDebugLogFlags_EventClipper to avoid spamming)\n");
DebugLog("(Debug Log: Auto-disabled ImGuiDebugLogFlags_EventClipper after 2 frames)\n");
g.DebugLogFlags &= ~ImGuiDebugLogFlags_EventClipper;
}
@ -14939,6 +14939,9 @@ void ImGui::ShowDebugLogWindow(bool* p_open)
SetClipboardText(g.DebugLogBuf.c_str());
BeginChild("##log", ImVec2(0.0f, 0.0f), ImGuiChildFlags_Border, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_AlwaysHorizontalScrollbar);
const ImGuiDebugLogFlags backup_log_flags = g.DebugLogFlags;
g.DebugLogFlags &= ~ImGuiDebugLogFlags_EventClipper;
ImGuiListClipper clipper;
clipper.Begin(g.DebugLogIndex.size());
while (clipper.Step())
@ -14946,10 +14949,10 @@ void ImGui::ShowDebugLogWindow(bool* p_open)
{
const char* line_begin = g.DebugLogIndex.get_line_begin(g.DebugLogBuf.c_str(), line_no);
const char* line_end = g.DebugLogIndex.get_line_end(g.DebugLogBuf.c_str(), line_no);
TextUnformatted(line_begin, line_end);
TextUnformatted(line_begin, line_end); // Display line
ImRect text_rect = g.LastItemData.Rect;
if (IsItemHovered())
for (const char* p = line_begin; p <= line_end - 10; p++)
for (const char* p = line_begin; p <= line_end - 10; p++) // Search for 0x???????? identifiers
{
ImGuiID id = 0;
if (p[0] != '0' || (p[1] != 'x' && p[1] != 'X') || sscanf(p + 2, "%X", &id) != 1)
@ -14962,6 +14965,7 @@ void ImGui::ShowDebugLogWindow(bool* p_open)
p += 10;
}
}
g.DebugLogFlags = backup_log_flags;
if (GetScrollY() >= GetScrollMaxY())
SetScrollHereY(1.0f);
EndChild();

Loading…
Cancel
Save