Debug: extracted debug log 0xXXXXXXX scanning into a helper function. (#5855)

features/sdl_renderer3_multiviewports
ocornut ago%!(EXTRA string=11 months)
parent 109a8632d7
commit 868f444620
  1. 2
      docs/README.md
  2. 28
      imgui.cpp
  3. 2
      imgui.h
  4. 1
      imgui_internal.h

@ -162,7 +162,7 @@ See: [Upcoming Changes](https://github.com/ocornut/imgui/wiki/Upcoming-Changes).
See: [Dear ImGui Test Engine + Test Suite](https://github.com/ocornut/imgui_test_engine) for Automation & Testing. See: [Dear ImGui Test Engine + Test Suite](https://github.com/ocornut/imgui_test_engine) for Automation & Testing.
For the purposes of getting search engines to crawl the wiki, here's a link to the [Crawable Wiki](https://github-wiki-see.page/m/ocornut/imgui/wiki) (not for humans, [here's why](https://github-wiki-see.page/)). For the purposes of getting search engines to crawl the wiki, here's a link to the [Crawlable Wiki](https://github-wiki-see.page/m/ocornut/imgui/wiki) (not for humans, [here's why](https://github-wiki-see.page/)).
Getting started? For first-time users having issues compiling/linking/running or issues loading fonts, please use [GitHub Discussions](https://github.com/ocornut/imgui/discussions). For ANY other questions, bug reports, requests, feedback, please post on [GitHub Issues](https://github.com/ocornut/imgui/issues). Please read and fill the New Issue template carefully. Getting started? For first-time users having issues compiling/linking/running or issues loading fonts, please use [GitHub Discussions](https://github.com/ocornut/imgui/discussions). For ANY other questions, bug reports, requests, feedback, please post on [GitHub Issues](https://github.com/ocornut/imgui/issues). Please read and fill the New Issue template carefully.

@ -15637,13 +15637,24 @@ void ImGui::ShowDebugLogWindow(bool* p_open)
clipper.Begin(g.DebugLogIndex.size()); clipper.Begin(g.DebugLogIndex.size());
while (clipper.Step()) while (clipper.Step())
for (int line_no = clipper.DisplayStart; line_no < clipper.DisplayEnd; line_no++) for (int line_no = clipper.DisplayStart; line_no < clipper.DisplayEnd; line_no++)
DebugTextUnformattedWithLocateItem(g.DebugLogIndex.get_line_begin(g.DebugLogBuf.c_str(), line_no), g.DebugLogIndex.get_line_end(g.DebugLogBuf.c_str(), line_no));
g.DebugLogFlags = backup_log_flags;
if (GetScrollY() >= GetScrollMaxY())
SetScrollHereY(1.0f);
EndChild();
End();
}
// Display line, search for 0xXXXXXXXX identifiers and call DebugLocateItemOnHover() when hovered.
void ImGui::DebugTextUnformattedWithLocateItem(const char* line_begin, const char* line_end)
{ {
const char* line_begin = g.DebugLogIndex.get_line_begin(g.DebugLogBuf.c_str(), line_no); TextUnformatted(line_begin, line_end);
const char* line_end = g.DebugLogIndex.get_line_end(g.DebugLogBuf.c_str(), line_no); if (!IsItemHovered())
TextUnformatted(line_begin, line_end); // Display line return;
ImGuiContext& g = *GImGui;
ImRect text_rect = g.LastItemData.Rect; 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; ImGuiID id = 0;
if (p[0] != '0' || (p[1] != 'x' && p[1] != 'X') || sscanf(p + 2, "%X", &id) != 1) if (p[0] != '0' || (p[1] != 'x' && p[1] != 'X') || sscanf(p + 2, "%X", &id) != 1)
@ -15656,13 +15667,6 @@ void ImGui::ShowDebugLogWindow(bool* p_open)
p += 10; p += 10;
} }
} }
g.DebugLogFlags = backup_log_flags;
if (GetScrollY() >= GetScrollMaxY())
SetScrollHereY(1.0f);
EndChild();
End();
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// [SECTION] OTHER DEBUG TOOLS (ITEM PICKER, ID STACK TOOL) // [SECTION] OTHER DEBUG TOOLS (ITEM PICKER, ID STACK TOOL)

@ -28,7 +28,7 @@
// Library Version // Library Version
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345') // (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
#define IMGUI_VERSION "1.90.8 WIP" #define IMGUI_VERSION "1.90.8 WIP"
#define IMGUI_VERSION_NUM 19071 #define IMGUI_VERSION_NUM 19072
#define IMGUI_HAS_TABLE #define IMGUI_HAS_TABLE
/* /*

@ -3495,6 +3495,7 @@ namespace ImGui
IMGUI_API void DebugDrawCursorPos(ImU32 col = IM_COL32(255, 0, 0, 255)); IMGUI_API void DebugDrawCursorPos(ImU32 col = IM_COL32(255, 0, 0, 255));
IMGUI_API void DebugDrawLineExtents(ImU32 col = IM_COL32(255, 0, 0, 255)); IMGUI_API void DebugDrawLineExtents(ImU32 col = IM_COL32(255, 0, 0, 255));
IMGUI_API void DebugDrawItemRect(ImU32 col = IM_COL32(255, 0, 0, 255)); IMGUI_API void DebugDrawItemRect(ImU32 col = IM_COL32(255, 0, 0, 255));
IMGUI_API void DebugTextUnformattedWithLocateItem(const char* line_begin, const char* line_end);
IMGUI_API void DebugLocateItem(ImGuiID target_id); // Call sparingly: only 1 at the same time! IMGUI_API void DebugLocateItem(ImGuiID target_id); // Call sparingly: only 1 at the same time!
IMGUI_API void DebugLocateItemOnHover(ImGuiID target_id); // Only call on reaction to a mouse Hover: because only 1 at the same time! IMGUI_API void DebugLocateItemOnHover(ImGuiID target_id); // Only call on reaction to a mouse Hover: because only 1 at the same time!
IMGUI_API void DebugLocateItemResolveWithLastItem(); IMGUI_API void DebugLocateItemResolveWithLastItem();

Loading…
Cancel
Save