Skip to content

Commit

Permalink
fix textbox crash, fix ctrl+c / ctrl+x to not copy an empty string wh…
Browse files Browse the repository at this point in the history
…en the textbox is empty
  • Loading branch information
jacob1 committed Sep 11, 2015
1 parent a629979 commit 81b2efa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/gui/interface/Label.cpp
Expand Up @@ -215,6 +215,8 @@ void Label::copySelection()
copyText = currentText.substr(selectionIndex0, selectionIndex1-selectionIndex0).c_str();
else if(selectionIndex0 > selectionIndex1)
copyText = currentText.substr(selectionIndex1, selectionIndex0-selectionIndex1).c_str();
else if (!currentText.length())
return;
else
copyText = currentText.c_str();
ClipboardPush(format::CleanString(copyText, false, true, false));
Expand Down
3 changes: 3 additions & 0 deletions src/gui/interface/Textbox.cpp
Expand Up @@ -146,8 +146,11 @@ void Textbox::cutSelection()
}
else
{
if (!backingText.length())
return;
ClipboardPush(format::CleanString(backingText, false, true, false));
backingText.clear();
cursor = 0;
}
ClearSelection();

Expand Down

0 comments on commit 81b2efa

Please sign in to comment.