summaryrefslogtreecommitdiff
path: root/src/gui/textbox.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2008-10-10 20:51:00 +0000
committerIra Rice <irarice@gmail.com>2008-10-10 20:51:00 +0000
commitd5736cdc5700994520a53fdd560fd7ea946f6e63 (patch)
tree04c377e8f263708d328effbbd2c366c1462123c2 /src/gui/textbox.cpp
parentaede5be60657a6a5d9aa6989a454cedde3230b75 (diff)
downloadMana-d5736cdc5700994520a53fdd560fd7ea946f6e63.tar.gz
Mana-d5736cdc5700994520a53fdd560fd7ea946f6e63.tar.bz2
Mana-d5736cdc5700994520a53fdd560fd7ea946f6e63.tar.xz
Mana-d5736cdc5700994520a53fdd560fd7ea946f6e63.zip
Fixed the text box so that it now checks the last line as well for the
minimum length for the text box (it didn't do that before)
Diffstat (limited to 'src/gui/textbox.cpp')
-rw-r--r--src/gui/textbox.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/gui/textbox.cpp b/src/gui/textbox.cpp
index e779a9bb..1a689ad5 100644
--- a/src/gui/textbox.cpp
+++ b/src/gui/textbox.cpp
@@ -46,6 +46,7 @@ void TextBox::setTextWrapped(const std::string &text)
std::stringstream wrappedStream;
std::string::size_type newlinePos, lastNewlinePos = 0;
int minWidth = 0;
+ int xpos;
do
{
@@ -60,7 +61,7 @@ void TextBox::setTextWrapped(const std::string &text)
std::string line =
text.substr(lastNewlinePos, newlinePos - lastNewlinePos);
std::string::size_type spacePos, lastSpacePos = 0;
- int xpos = 0;
+ xpos = 0;
do
{
@@ -110,7 +111,15 @@ void TextBox::setTextWrapped(const std::string &text)
lastNewlinePos = newlinePos + 1;
}
while (newlinePos != text.size());
- mMinWidth = minWidth;
+
+ if (xpos > minWidth)
+ {
+ minWidth = xpos;
+ }
+ if (minWidth > mMinWidth)
+ {
+ mMinWidth = minWidth;
+ }
gcn::TextBox::setText(wrappedStream.str());
}