🪲 TextBox::getSelectedText sometimes contained newlines that were not in the original text (they where added internally for word wrapping)

0.8
Bruno Van de Velde 2017-10-06 19:44:23 +02:00
parent a6ca360704
commit 0f9e59c826
1 changed files with 5 additions and 1 deletions

View File

@ -149,7 +149,11 @@ namespace tgui
sf::String TextBox::getSelectedText() const
{
return m_textSelection1.getString() + m_textSelection2.getString();
auto pos = findTextSelectionPositions();
if (pos.first > pos.second)
std::swap(pos.first, pos.second);
return m_text.substring(pos.first, pos.second - pos.first);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////