1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-12-18 18:46:13 +01:00

ImStrv: enhanced VS debugger .natvis support. build fixes. (5333, 5906)

This commit is contained in:
璀境石 2022-08-22 11:05:58 +02:00 committed by ocornut
parent a1874dc3ea
commit a89954754a
2 changed files with 5 additions and 4 deletions

View File

@ -16517,7 +16517,7 @@ void ImGui::ShowDebugLogWindow(bool* p_open)
// Display line, search for 0xXXXXXXXX identifiers and call DebugLocateItemOnHover() when hovered. // Display line, search for 0xXXXXXXXX identifiers and call DebugLocateItemOnHover() when hovered.
void ImGui::DebugTextUnformattedWithLocateItem(const char* line_begin, const char* line_end) void ImGui::DebugTextUnformattedWithLocateItem(const char* line_begin, const char* line_end)
{ {
TextUnformatted(line_begin, line_end); TextUnformatted(ImStrv(line_begin, line_end));
if (!IsItemHovered()) if (!IsItemHovered())
return; return;
ImGuiContext& g = *GImGui; ImGuiContext& g = *GImGui;
@ -16527,8 +16527,8 @@ void ImGui::DebugTextUnformattedWithLocateItem(const char* line_begin, const cha
ImGuiID id = 0; ImGuiID id = 0;
if (p[0] != '0' || (p[1] != 'x' && p[1] != 'X') || sscanf(p + 2, "%X", &id) != 1 || ImCharIsXdigitA(p[10])) if (p[0] != '0' || (p[1] != 'x' && p[1] != 'X') || sscanf(p + 2, "%X", &id) != 1 || ImCharIsXdigitA(p[10]))
continue; continue;
ImVec2 p0 = CalcTextSize(line_begin, p); ImVec2 p0 = CalcTextSize(ImStrv(line_begin, p));
ImVec2 p1 = CalcTextSize(p, p + 10); ImVec2 p1 = CalcTextSize(ImStrv(p, p + 10));
g.LastItemData.Rect = ImRect(text_rect.Min + ImVec2(p0.x, 0.0f), text_rect.Min + ImVec2(p0.x + p1.x, p1.y)); g.LastItemData.Rect = ImRect(text_rect.Min + ImVec2(p0.x, 0.0f), text_rect.Min + ImVec2(p0.x + p1.x, p1.y));
if (IsMouseHoveringRect(g.LastItemData.Rect.Min, g.LastItemData.Rect.Max, true)) if (IsMouseHoveringRect(g.LastItemData.Rect.Min, g.LastItemData.Rect.Max, true))
DebugLocateItemOnHover(id); DebugLocateItemOnHover(id);

View File

@ -53,7 +53,8 @@ More information at: https://docs.microsoft.com/en-us/visualstudio/debugger/crea
<!-- String view (non zero-terminated begin/end pair) --> <!-- String view (non zero-terminated begin/end pair) -->
<Type Name="ImStrv"> <Type Name="ImStrv">
<DisplayString>{Begin,[End-Begin]s} ({End-Begin,d})</DisplayString> <DisplayString>{Begin,[End-Begin]s8} ({End-Begin,d})</DisplayString>
<StringView>Begin,[End-Begin]s8</StringView>
</Type> </Type>
<Type Name="ImGuiWindow"> <Type Name="ImGuiWindow">