summaryrefslogtreecommitdiff
path: root/src/interface
diff options
context:
space:
mode:
Diffstat (limited to 'src/interface')
-rw-r--r--src/interface/Label.cpp42
-rw-r--r--src/interface/Textbox.cpp2
2 files changed, 23 insertions, 21 deletions
diff --git a/src/interface/Label.cpp b/src/interface/Label.cpp
index 80387ce..5cd089c 100644
--- a/src/interface/Label.cpp
+++ b/src/interface/Label.cpp
@@ -96,23 +96,30 @@ void Label::updateMultiline()
lines++;
break;
default:
- if(pc == ' ')
- {
- wordStart = &rawText[charIndex-2];
- }
wordWidth += Graphics::CharWidth(c);
- if(lineWidth + wordWidth >= Size.X-(Appearance.Margin.Left+Appearance.Margin.Right))
- {
- if(wordStart && *wordStart)
- *wordStart = '\n';
- else if(!wordStart)
- rawText[charIndex-1] = '\n';
- lineWidth = wordWidth;
- wordWidth = 0;
- lines++;
- }
break;
}
+ if(pc == ' ')
+ {
+ wordStart = &rawText[charIndex-2];
+ }
+ if ((c != ' ' || pc == ' ') && lineWidth + wordWidth >= Size.X-(Appearance.Margin.Left+Appearance.Margin.Right))
+ {
+ if(wordStart && *wordStart)
+ {
+ *wordStart = '\n';
+ if (lineWidth != 0)
+ lineWidth = wordWidth;
+ }
+ else if(!wordStart)
+ {
+ rawText[charIndex-1] = '\n';
+ lineWidth = 0;
+ }
+ wordWidth = 0;
+ wordStart = 0;
+ lines++;
+ }
pc = c;
}
if(autoHeight)
@@ -201,12 +208,7 @@ void Label::OnMouseClick(int x, int y, unsigned button)
void Label::copySelection()
{
- std::string currentText;
-
- if(multiline)
- currentText = textLines;
- else
- currentText = text;
+ std::string currentText = text;
if(selectionIndex1 > selectionIndex0) {
clipboard_push_text((char*)currentText.substr(selectionIndex0, selectionIndex1-selectionIndex0).c_str());
diff --git a/src/interface/Textbox.cpp b/src/interface/Textbox.cpp
index 383f07b..c82b6e4 100644
--- a/src/interface/Textbox.cpp
+++ b/src/interface/Textbox.cpp
@@ -447,7 +447,7 @@ void Textbox::OnVKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
backingText.erase(backingText.begin());
}
if(cursor > backingText.length())
- cursor = backingText.length();
+ cursor = backingText.length();
if(changed)
{
if(masked)