summaryrefslogtreecommitdiff
path: root/src/gui/widgets/browserbox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets/browserbox.cpp')
-rw-r--r--src/gui/widgets/browserbox.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index e4f0774b..b1ae5eb7 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -386,7 +386,7 @@ void BrowserBox::draw(gcn::Graphics *graphics)
// Auto wrap mode
if (mMode == AUTO_WRAP &&
- (x + font->getWidth(part.c_str()) + 10) > getWidth())
+ (x + font->getWidth(part) + 10) > getWidth())
{
bool forced = false;
char const *hyphen = "~";
@@ -399,14 +399,14 @@ void BrowserBox::draw(gcn::Graphics *graphics)
do
{
if (!forced)
- end = row.rfind(" ", end);
+ end = row.rfind(' ', end);
// Check if we have to (stupidly) force-wrap
if (end == std::string::npos || end <= start)
{
forced = true;
end = row.size();
- x += hyphenWidth * 2; // Account for the wrap-notifier
+ x += hyphenWidth; // Account for the wrap-notifier
continue;
}
@@ -416,7 +416,7 @@ void BrowserBox::draw(gcn::Graphics *graphics)
end--; // And then to the last byte of the previous one
part = row.substr(start, end - start + 1);
- } while ((x + font->getWidth(part.c_str()) + 10) > getWidth());
+ } while (end > start && (x + font->getWidth(part) + 10) > getWidth());
if (forced)
{
@@ -432,7 +432,7 @@ void BrowserBox::draw(gcn::Graphics *graphics)
wrappedLines++;
}
font->drawString(graphics, part, x, y);
- x += font->getWidth(part.c_str());
+ x += font->getWidth(part);
}
y += font->getHeight();
setHeight((mTextRows.size() + wrappedLines) * font->getHeight());