Newlines are now converted to spaces when pasting text into single-line input fields

This commit is contained in:
Leon Styhre 2023-10-20 17:40:44 +02:00
parent db5948ee4b
commit 9283cdff84

View file

@ -97,8 +97,12 @@ void TextEditComponent::textInput(const std::string& text, const bool pasting)
}
}
else {
mText.insert(mCursor, text);
mCursor += static_cast<unsigned int>(text.size());
mText.insert(
mCursor,
(pasting && !isMultiline() ? Utils::String::replace(text, "\n", " ") : text));
mCursor += static_cast<unsigned int>(
(pasting && !isMultiline() ? Utils::String::replace(text, "\n", " ") : text)
.size());
}
}