From d5736cdc5700994520a53fdd560fd7ea946f6e63 Mon Sep 17 00:00:00 2001 From: Ira Rice Date: Fri, 10 Oct 2008 20:51:00 +0000 Subject: 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) --- src/gui/textbox.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/gui') 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()); } -- cgit v1.2.3-70-g09d2