summaryrefslogtreecommitdiff
path: root/src/interface/Label.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/interface/Label.cpp')
-rw-r--r--src/interface/Label.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/interface/Label.cpp b/src/interface/Label.cpp
index e19b6b8..96a8520 100644
--- a/src/interface/Label.cpp
+++ b/src/interface/Label.cpp
@@ -80,11 +80,17 @@ void Label::updateMultiline()
char * lastSpace = NULL;
char * currentWord = rawText;
char * nextSpace;
+ char oldChar;
while(true)
{
nextSpace = strchr(currentWord+1, ' ');
+ if(nextSpace > strchr(currentWord+1, '\n'))
+ nextSpace = strchr(currentWord+1, '\n');
if(nextSpace)
+ {
+ oldChar = nextSpace[0];
nextSpace[0] = 0;
+ }
int width = Graphics::textwidth(currentWord);
if(width+currentWidth >= Size.X-(Appearance.Margin.Left+Appearance.Margin.Right))
{
@@ -95,10 +101,15 @@ void Label::updateMultiline()
lines++;
}
}
+ else if(oldChar == '\n')
+ {
+ currentWidth = width;
+ lines++;
+ }
else
currentWidth += width;
if(nextSpace)
- nextSpace[0] = ' ';
+ nextSpace[0] = oldChar;
if(!currentWord[0] || !currentWord[1] || !(currentWord = strchr(currentWord+1, ' ')))
break;
}