You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 paragraphImGui::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 wrappingImGui::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();
The text was updated successfully, but these errors were encountered:
I just found #2313, which asks much the same question. The code in #2313 (comment) seems to work, if I have adapted it correctly to a newer version of Dear ImGui.
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:
The text was updated successfully, but these errors were encountered: