summaryrefslogtreecommitdiff
path: root/src/gui/widgets/textbox.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-04-20 21:41:17 +0200
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-04-20 21:41:17 +0200
commit0689ecac058ce1ef063b0250c48a39ed1db11f82 (patch)
tree24107360261ae3431e06a33fa6951b4516690d6b /src/gui/widgets/textbox.cpp
parent8f1421e791ac6cbb7af3bde69f1b44e0f8fd080d (diff)
downloadMana-0689ecac058ce1ef063b0250c48a39ed1db11f82.tar.gz
Mana-0689ecac058ce1ef063b0250c48a39ed1db11f82.tar.bz2
Mana-0689ecac058ce1ef063b0250c48a39ed1db11f82.tar.xz
Mana-0689ecac058ce1ef063b0250c48a39ed1db11f82.zip
Fixed a fairly obscure text wrapping bug.
Signed-off-by: Tametomo <irarice@gmail.com> Signed-off-by: Bjørn Lindeijer <bjorn@lindeijer.nl>
Diffstat (limited to 'src/gui/widgets/textbox.cpp')
-rw-r--r--src/gui/widgets/textbox.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp
index 4c463078..3c05ef84 100644
--- a/src/gui/widgets/textbox.cpp
+++ b/src/gui/widgets/textbox.cpp
@@ -85,9 +85,16 @@ void TextBox::setTextWrapped(const std::string &text, int minDimension)
int width = getFont()->getWidth(word);
- if (xpos != 0 && xpos + width + getFont()->getWidth(" ") <= mMinWidth)
+ if (xpos == 0 && width > mMinWidth)
{
- xpos += width + getFont()->getWidth(" ");
+ mMinWidth = width;
+ xpos = width;
+ wrappedStream << word;
+ }
+ else if (xpos != 0 && xpos + getFont()->getWidth(" ") + width <=
+ mMinWidth)
+ {
+ xpos += getFont()->getWidth(" ") + width;
wrappedStream << " " << word;
}
else if (lastSpacePos == 0)