diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index fcaa4665c..05b0f9af8 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -69,6 +69,7 @@ Other changes: consistency. (#7411) [@cfillion] - DrawList: Added AddConcavePolyFilled(), PathFillConcave() concave filling. (#760) [@thedmd] Note that only simple polygons (no self-intersections, no holes) are supported. +- DrawList: Allow AddText() to accept null ranges. (#3615, 7391) - Docs: added more wiki links to headers of imgui.h/imgui.cpp to facilitate discovery of interesting resources, because github doesn't allow Wiki to be crawled by search engines. - This is the main wiki: https://github.com/ocornut/imgui/wiki diff --git a/imgui.h b/imgui.h index b65b6973c..782bf891f 100644 --- a/imgui.h +++ b/imgui.h @@ -28,7 +28,7 @@ // Library Version // (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345') #define IMGUI_VERSION "1.90.5 WIP" -#define IMGUI_VERSION_NUM 19046 +#define IMGUI_VERSION_NUM 19047 #define IMGUI_HAS_TABLE /* @@ -177,7 +177,7 @@ struct ImGuiViewport; // A Platform Window (always only one in 'ma // - Tip: Use your programming IDE navigation facilities on the names in the _central column_ below to find the actual flags/enum lists! // - In Visual Studio: CTRL+comma ("Edit.GoToAll") can follow symbols inside comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot. // - In Visual Studio w/ Visual Assist installed: ALT+G ("VAssistX.GoToImplementation") can also follow symbols inside comments. -// - In Visual Studio Code: CTRL+click can follow symbols inside comments. +// - In VS Code, CLion, etc.: CTRL+click can follow symbols inside comments. enum ImGuiKey : int; // -> enum ImGuiKey // Enum: A key identifier (ImGuiKey_XXX or ImGuiMod_XXX value) enum ImGuiMouseSource : int; // -> enum ImGuiMouseSource // Enum; A mouse input source identifier (Mouse, TouchScreen, Pen) typedef int ImGuiCol; // -> enum ImGuiCol_ // Enum: A color identifier for styling @@ -194,7 +194,7 @@ typedef int ImGuiTableBgTarget; // -> enum ImGuiTableBgTarget_ // Enum: A // - Tip: Use your programming IDE navigation facilities on the names in the _central column_ below to find the actual flags/enum lists! // - In Visual Studio: CTRL+comma ("Edit.GoToAll") can follow symbols inside comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot. // - In Visual Studio w/ Visual Assist installed: ALT+G ("VAssistX.GoToImplementation") can also follow symbols inside comments. -// - In Visual Studio Code: CTRL+click can follow symbols inside comments. +// - In VS Code, CLion, etc.: CTRL+click can follow symbols inside comments. typedef int ImDrawFlags; // -> enum ImDrawFlags_ // Flags: for ImDrawList functions typedef int ImDrawListFlags; // -> enum ImDrawListFlags_ // Flags: for ImDrawList instance typedef int ImFontAtlasFlags; // -> enum ImFontAtlasFlags_ // Flags: for ImFontAtlas build @@ -1551,7 +1551,7 @@ enum ImGuiCol_ // - Tip: Use your programming IDE navigation facilities on the names in the _second column_ below to find the actual members and their description. // - In Visual Studio: CTRL+comma ("Edit.GoToAll") can follow symbols inside comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot. // - In Visual Studio w/ Visual Assist installed: ALT+G ("VAssistX.GoToImplementation") can also follow symbols inside comments. -// - In Visual Studio Code: CTRL+click can follow symbols inside comments. +// - In VS Code, CLion, etc.: CTRL+click can follow symbols inside comments. // - When changing this enum, you need to update the associated internal table GStyleVarInfo[] accordingly. This is where we link enum values to members offset/type. enum ImGuiStyleVar_ { diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 5c33c0a1f..f739dfabe 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -56,7 +56,7 @@ // Navigating this file: // - In Visual Studio: CTRL+comma ("Edit.GoToAll") can follow symbols inside comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot. // - In Visual Studio w/ Visual Assist installed: ALT+G ("VAssistX.GoToImplementation") can also follow symbols inside comments. -// - In Visual Studio Code: CTRL+click can follow symbols inside comments. +// - In VS Code, CLion, etc.: CTRL+click can follow symbols inside comments. /* diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 405684f54..83e29e10f 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -1613,10 +1613,11 @@ void ImDrawList::AddText(const ImFont* font, float font_size, const ImVec2& pos, if ((col & IM_COL32_A_MASK) == 0) return; + // Accept null ranges + if (text_begin == text_end || text_begin[0] == 0) + return; if (text_end == NULL) text_end = text_begin + strlen(text_begin); - if (text_begin == text_end) - return; // Pull default font/size from the shared ImDrawListSharedData instance if (font == NULL) diff --git a/imgui_tables.cpp b/imgui_tables.cpp index 443321cd8..88433da28 100644 --- a/imgui_tables.cpp +++ b/imgui_tables.cpp @@ -26,7 +26,7 @@ Index of this file: // Navigating this file: // - In Visual Studio: CTRL+comma ("Edit.GoToAll") can follow symbols inside comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot. // - In Visual Studio w/ Visual Assist installed: ALT+G ("VAssistX.GoToImplementation") can also follow symbols inside comments. -// - In Visual Studio Code: CTRL+click can follow symbols inside comments. +// - In VS Code, CLion, etc.: CTRL+click can follow symbols inside comments. //----------------------------------------------------------------------------- // [SECTION] Commentary