From 0689ecac058ce1ef063b0250c48a39ed1db11f82 Mon Sep 17 00:00:00 2001 From: Ira Rice Date: Mon, 20 Apr 2009 21:41:17 +0200 Subject: Fixed a fairly obscure text wrapping bug. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tametomo Signed-off-by: Bjørn Lindeijer --- src/gui/widgets/textbox.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/gui/widgets') 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) -- cgit v1.2.3-60-g2f50