I am trying to wrap a paragraph of text in the usual manner, except that the paragraph has some color in the middle. The result is that each of the segments of text are wrapped separately, rather than as a whole paragraph.
Am I misunderstanding the API? Is there documentation that explains how wrapping actually works?
Screenshots/Video:
Minimal, Complete and Verifiable Example code:
ImGui::SetNextWindowSize( { 500, 300 }, ImGuiCond_Once );
if( ImGui::Begin( "test" ) ) {
// three sentences in a nicely–wrapped paragraph
ImGui::TextWrapped( "%s", "Some long text that will wrap around nicely. Some red text in the middle. Some long text that will wrap around nicely." );
ImGui::NewLine();
// same three sentences, but the color breaks the wrapping
ImGui::PushTextWrapPos( 0 );
ImGui::TextUnformatted( "Some long text that will wrap around nicely." );
ImGui::SameLine();
ImGui::TextColored( c_red, "%s", "Some red text in the middle." );
ImGui::SameLine();
ImGui::TextUnformatted( "Some long text that will wrap around nicely." );
ImGui::PopTextWrapPos();
}
ImGui::End();
Version/Branch of Dear ImGui:
Version 1.89.6, Branch: master
Back-ends:
imgui_impl_sdl2.cpp
Compiler, OS:
gcc (GCC) 11.3.0, Linux
Full config/build information:
Details:
I am trying to wrap a paragraph of text in the usual manner, except that the paragraph has some color in the middle. The result is that each of the segments of text are wrapped separately, rather than as a whole paragraph.
Am I misunderstanding the API? Is there documentation that explains how wrapping actually works?
Screenshots/Video:
Minimal, Complete and Verifiable Example code: