mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-10-27 08:37:58 +03:00
Fix Text::wrapText for string views.
ecode: Minor visual fixes.
This commit is contained in:
@@ -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<Float>(
|
||||
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
|
||||
|
||||
@@ -1447,8 +1447,7 @@ void GitPlugin::buildSidePanelTab() {
|
||||
</vbox>
|
||||
</StackWidget>
|
||||
</vbox>
|
||||
<TextView id="git_no_content" lw="mp" lh="wc" word-wrap="true" visible="false"
|
||||
text='@string(git_no_git_repo, "Current folder is not a Git repository.")' padding="16dp" />
|
||||
<TextView id="git_no_content" lw="mp" lh="wc" word-wrap="true" visible="false" text='@string(git_no_git_repo, "Current folder is not a Git repository.")' margin="8dp" text-align="center" />
|
||||
<Loader margin-top="32dp" id="git_panel_loader" indeterminate="true" lw="24dp" lh="24dp" outline-thickness="2dp" visible="false" layout_gravity="bottom|right" margin-bottom="24dp" margin-right="24dp" />
|
||||
</RelativeLayout>
|
||||
)html";
|
||||
|
||||
@@ -1040,7 +1040,7 @@ void ProjectBuildManager::buildSidePanelTab() {
|
||||
<vbox lw="mp" lh="wc" padding="4dp">
|
||||
<TextView text="@string(build_settings, Build Settings)" font-size="15dp" focusable="false" />
|
||||
<TextView text="@string(build_configuration, Build Configuration)" focusable="false" />
|
||||
<hbox lw="mp" lh="wc" margin-bottom="4dp">
|
||||
<hbox lw="mp" lh="wc" margin-top="2dp" margin-bottom="4dp">
|
||||
<DropDownList id="build_list" layout_width="0" lw8="1" layout_height="wrap_content" />
|
||||
<PushButton id="build_edit" id="build_edit" text="@string(edit_build, Edit Build)" tooltip="@string(edit_build, Edit Build)" text-as-fallback="true" icon="icon(file-edit, 12dp)" margin-left="2dp" />
|
||||
<PushButton id="build_add" id="build_add" text="@string(add_build, Add Build)" tooltip="@string(add_build, Add Build)" text-as-fallback="true" icon="icon(add, 12dp)" margin-left="2dp" />
|
||||
|
||||
Reference in New Issue
Block a user