summaryrefslogtreecommitdiff
path: root/src/gui/textbox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/textbox.cpp')
-rw-r--r--src/gui/textbox.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/gui/textbox.cpp b/src/gui/textbox.cpp
index c04b4262..e7986244 100644
--- a/src/gui/textbox.cpp
+++ b/src/gui/textbox.cpp
@@ -66,11 +66,8 @@ void TextBox::setTextWrapped(const std::string &text, int minDimension)
xpos = 0;
spacePos = text.rfind(" ", text.size());
- if (spacePos == std::string::npos)
- {
- spacePos = 0;
- }
- else
+
+ if (spacePos != std::string::npos)
{
const std::string word = text.substr(spacePos + 1);
const int length = getFont()->getWidth(word);
@@ -78,6 +75,7 @@ void TextBox::setTextWrapped(const std::string &text, int minDimension)
if (length > mMinWidth)
mMinWidth = length;
}
+
do
{
spacePos = line.find(" ", lastSpacePos);