diff options
author | Ira Rice <irarice@gmail.com> | 2008-10-10 20:51:00 +0000 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2008-10-10 20:51:00 +0000 |
commit | d5736cdc5700994520a53fdd560fd7ea946f6e63 (patch) | |
tree | 04c377e8f263708d328effbbd2c366c1462123c2 | |
parent | aede5be60657a6a5d9aa6989a454cedde3230b75 (diff) | |
download | mana-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)
-rw-r--r-- | src/gui/textbox.cpp | 13 |
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()); } |