mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-11-04 07:01:04 +01:00 
			
		
		
		
	Debug Tools: Debug Log: add and use ImGuiTextLineIndex.
This is needed for next commit where we want to parse hovered Debug Log line.
This commit is contained in:
		@@ -302,6 +302,7 @@ namespace ImStb
 | 
			
		||||
// - Helper: ImSpan<>, ImSpanAllocator<>
 | 
			
		||||
// - Helper: ImPool<>
 | 
			
		||||
// - Helper: ImChunkStream<>
 | 
			
		||||
// - Helper: ImGuiTextIndex
 | 
			
		||||
//-----------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
// Helpers: Hashing
 | 
			
		||||
@@ -694,6 +695,20 @@ struct ImChunkStream
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// Helper: ImGuiTextIndex<>
 | 
			
		||||
// Maintain a line index for a text buffer. This is a strong candidate to be moved into the public API.
 | 
			
		||||
struct ImGuiTextIndex
 | 
			
		||||
{
 | 
			
		||||
    ImVector<int>   LineOffsets;
 | 
			
		||||
    int             EndOffset = 0;                          // Because we don't own text buffer we need to maintain EndOffset (may bake in LineOffsets?)
 | 
			
		||||
 | 
			
		||||
    void            clear()                                 { LineOffsets.clear(); EndOffset = 0; }
 | 
			
		||||
    int             size()                                  { return LineOffsets.Size; }
 | 
			
		||||
    const char*     get_line_begin(const char* base, int n) { return base + LineOffsets[n]; }
 | 
			
		||||
    const char*     get_line_end(const char* base, int n)   { return base + (n + 1 < LineOffsets.Size ? (LineOffsets[n + 1] - 1) : EndOffset); }
 | 
			
		||||
    void            append(const char* base, int old_size, int new_size);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
//-----------------------------------------------------------------------------
 | 
			
		||||
// [SECTION] ImDrawList support
 | 
			
		||||
//-----------------------------------------------------------------------------
 | 
			
		||||
@@ -1850,6 +1865,7 @@ struct ImGuiContext
 | 
			
		||||
    // Debug Tools
 | 
			
		||||
    ImGuiDebugLogFlags      DebugLogFlags;
 | 
			
		||||
    ImGuiTextBuffer         DebugLogBuf;
 | 
			
		||||
    ImGuiTextIndex          DebugLogIndex;
 | 
			
		||||
    bool                    DebugItemPickerActive;              // Item picker is active (started with DebugStartItemPicker())
 | 
			
		||||
    ImU8                    DebugItemPickerMouseButton;
 | 
			
		||||
    ImGuiID                 DebugItemPickerBreakId;             // Will call IM_DEBUG_BREAK() when encountering this ID
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user