🪲 TextBox::getSelectedText sometimes contained newlines that were not in the original text (they where added internally for word wrapping)
parent
a6ca360704
commit
0f9e59c826
|
@ -149,7 +149,11 @@ namespace tgui
|
||||||
|
|
||||||
sf::String TextBox::getSelectedText() const
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Reference in New Issue