diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-09-13 17:33:12 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-09-13 17:33:12 (GMT) |
| commit | a11cd592cb9b985298dd16be78dec10226bf3e47 (patch) | |
| tree | c63a5d172970c4d5f28587c6263c689aca8fae95 /src/interface/Label.cpp | |
| parent | f7f51d5045a25a331b4cec3844f98584934d827e (diff) | |
| download | powder-a11cd592cb9b985298dd16be78dec10226bf3e47.zip powder-a11cd592cb9b985298dd16be78dec10226bf3e47.tar.gz | |
Show version info in update prompt. Fixes #177
Diffstat (limited to 'src/interface/Label.cpp')
| -rw-r--r-- | src/interface/Label.cpp | 13 |
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; } |
