diff --git a/src/eepp/graphics/text.cpp b/src/eepp/graphics/text.cpp index 2747e4d12..1af51eb58 100644 --- a/src/eepp/graphics/text.cpp +++ b/src/eepp/graphics/text.cpp @@ -337,6 +337,7 @@ bool Text::wrapText( Font* font, const Uint32& fontSize, StringType& string, con Float tMaxWidth = (Float)maxWidth; auto tChar = &string[0]; decltype( tChar ) tLastSpace = NULL; + decltype( tChar ) tLastChar = &string[ string.size() - 1 ]; Uint32 prevChar = 0; bool bold = ( style & Bold ) != 0; bool italic = ( style & Italic ) != 0; @@ -345,7 +346,7 @@ bool Text::wrapText( Font* font, const Uint32& fontSize, StringType& string, con Float hspace = static_cast( font->getGlyph( L' ', fontSize, bold, italic, outlineThickness ).advance ); - while ( *tChar ) { + while ( *tChar && tChar <= tLastChar ) { Glyph pChar = font->getGlyph( *tChar, fontSize, bold, italic, outlineThickness ); Float fCharWidth = (Float)pChar.advance; @@ -364,7 +365,7 @@ bool Text::wrapText( Font* font, const Uint32& fontSize, StringType& string, con prevChar = *tChar; } - if ( ' ' == *tChar || '\0' == *( tChar + 1 ) ) { + if ( ' ' == *tChar || tChar == tLastChar ) { // If current width plus word width is minor to the max width, continue adding if ( tCurWidth + tWordWidth < tMaxWidth ) { tCurWidth += tWordWidth; @@ -382,7 +383,7 @@ bool Text::wrapText( Font* font, const Uint32& fontSize, StringType& string, con wrapped = true; } - if ( '\0' == *( tChar + 1 ) ) + if ( tChar == tLastChar ) tChar++; // Set the last spaces as null, because is a new line diff --git a/src/tools/ecode/plugins/git/gitplugin.cpp b/src/tools/ecode/plugins/git/gitplugin.cpp index 14680e795..3ca78c45a 100644 --- a/src/tools/ecode/plugins/git/gitplugin.cpp +++ b/src/tools/ecode/plugins/git/gitplugin.cpp @@ -1447,8 +1447,7 @@ void GitPlugin::buildSidePanelTab() { - + )html"; diff --git a/src/tools/ecode/projectbuild.cpp b/src/tools/ecode/projectbuild.cpp index 0d6b54edc..91a03d95c 100644 --- a/src/tools/ecode/projectbuild.cpp +++ b/src/tools/ecode/projectbuild.cpp @@ -1040,7 +1040,7 @@ void ProjectBuildManager::buildSidePanelTab() { - +