8 #include "../common/utilities/string/split.h" 9 #include "../third-party/imgui/imgui.h" 16 auto non_space_index = remaining_paragraph.find_first_not_of(
' ' );
18 if( non_space_index != std::string::npos )
21 remaining_paragraph = remaining_paragraph.substr( non_space_index );
30 auto remaining_paragraph
36 auto next_word = remaining_paragraph.substr(
38 remaining_paragraph.find(
' ' ) );
39 bool first_word =
true;
41 while( ! next_word.empty() )
55 wrapped_line += next_word;
61 wrapped_paragraph += wrapped_line;
63 wrapped_paragraph +=
'\n';
64 wrapped_line = next_word;
72 if( remaining_paragraph.size() > next_word.size() )
74 remaining_paragraph = remaining_paragraph.substr( next_word.size() + 1 );
79 next_word = remaining_paragraph.substr( 0, remaining_paragraph.find(
' ' ) );
82 if( next_word.empty() )
84 wrapped_paragraph += wrapped_line;
90 wrapped_paragraph += wrapped_line;
95 return wrapped_paragraph;
101 if( wrap_pixels_width < 32 )
108 size_t line_number = 1;
110 for(
auto paragraph : paragraphs_vector )
114 if( line_number++ != paragraphs_vector.size() )
115 wrapped_text +=
'\n';
GLsizei const GLchar *const * string
IMGUI_API ImVec2 CalcTextSize(const char *text, const char *text_end=NULL, bool hide_text_after_double_hash=false, float wrap_width=-1.0f)
void trim_leading_spaces(std::string &remaining_paragraph)
std::string wrap_paragraph(const std::string ¶graph, int wrap_pixels_width)
std::vector< std::string > split(const std::string &str, char delimiter)
std::string wrap(const std::string &text, int wrap_pixels_width)