mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-11-04 07:01:04 +01:00 
			
		
		
		
	Debug Tools: Debug Log: Hide its own clipper log to reduce noise in the output.
This commit is contained in:
		
							
								
								
									
										10
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										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();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user