Version/Branch of Dear ImGui:
Version: 1.78 WIP
Branch: table
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_SDL.cpp + imgui_impl_opengl2.cpp
Compiler: GCC 9 / Clang 10
Operating System: Linux / Mac
My Issue/Question:
String larger than 3072 characters excluding null terminator are silently truncated when displayed by ImGui::TextWrapped.
In the following example, the last * character will no longer be displayed when the string size is increase past 3072.
#include <imgui.h>
#include <string>
#include <algorithm>
void showWindow()
{
if ( ImGui::Begin( "Window", nullptr ) )
{
static int len = 3072;
static std::string text;
if ( ImGui::SliderInt("len", & len, 1, 4096 ) || text.empty() )
{
text.clear();
text.reserve( len );
for ( int i = 0; i < ( len - 1 ); ++ i )
{
text += 'A' + static_cast< char > ( i % 26 );
}
text += "*";
}
ImGui::TextWrapped( "%s", text.c_str() );
}
ImGui::End();
}
Version/Branch of Dear ImGui:
Version: 1.78 WIP
Branch: table
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_SDL.cpp + imgui_impl_opengl2.cpp
Compiler: GCC 9 / Clang 10
Operating System: Linux / Mac
My Issue/Question:
String larger than 3072 characters excluding null terminator are silently truncated when displayed by ImGui::TextWrapped.
In the following example, the last * character will no longer be displayed when the string size is increase past 3072.