| 18109 | } |
| 18110 | |
| 18111 | static int DebugItemPathQuery_FormatLevelInfo(ImGuiDebugItemPathQuery* query, int n, bool format_for_ui, char* buf, size_t buf_size) |
| 18112 | { |
| 18113 | ImGuiStackLevelInfo* info = &query->Results[n]; |
| 18114 | ImGuiWindow* window = (info->DescOffset == -1 && n == 0) ? ImGui::FindWindowByID(info->ID) : NULL; |
| 18115 | if (window) // Source: window name (because the root ID don't call GetID() and so doesn't get hooked) |
| 18116 | return ImFormatString(buf, buf_size, format_for_ui ? "\"%s\" [window]" : "%s", ImHashSkipUncontributingPrefix(window->Name)); |
| 18117 | if (info->QuerySuccess) // Source: GetID() hooks (prioritize over ItemInfo() because we frequently use patterns like: PushID(str), Button("") where they both have same id) |
| 18118 | return ImFormatString(buf, buf_size, (format_for_ui && info->DataType == ImGuiDataType_String) ? "\"%s\"" : "%s", ImHashSkipUncontributingPrefix(&query->ResultsDescBuf.Buf[info->DescOffset])); |
| 18119 | if (query->Step < query->Results.Size) // Only start using fallback below when all queries are done, so during queries we don't flickering ??? markers. |
| 18120 | return (*buf = 0); |
| 18121 | #ifdef IMGUI_ENABLE_TEST_ENGINE |
| 18122 | if (const char* label = ImGuiTestEngine_FindItemDebugLabel(GImGui, info->ID)) // Source: ImGuiTestEngine's ItemInfo() |
| 18123 | return ImFormatString(buf, buf_size, format_for_ui ? "??? \"%s\"" : "%s", ImHashSkipUncontributingPrefix(label)); |
| 18124 | #endif |
| 18125 | return ImFormatString(buf, buf_size, "???"); |
| 18126 | } |
| 18127 | |
| 18128 | static const char* DebugItemPathQuery_GetResultAsPath(ImGuiDebugItemPathQuery* query, bool hex_encode_non_ascii_chars) |
| 18129 | { |
no test coverage detected