From 9283cdff84b3123af7d1f856c730bb9a99f28e00 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Fri, 20 Oct 2023 17:40:44 +0200 Subject: [PATCH] Newlines are now converted to spaces when pasting text into single-line input fields --- es-core/src/components/TextEditComponent.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/es-core/src/components/TextEditComponent.cpp b/es-core/src/components/TextEditComponent.cpp index 658864c81..a895f01e3 100644 --- a/es-core/src/components/TextEditComponent.cpp +++ b/es-core/src/components/TextEditComponent.cpp @@ -97,8 +97,12 @@ void TextEditComponent::textInput(const std::string& text, const bool pasting) } } else { - mText.insert(mCursor, text); - mCursor += static_cast(text.size()); + mText.insert( + mCursor, + (pasting && !isMultiline() ? Utils::String::replace(text, "\n", " ") : text)); + mCursor += static_cast( + (pasting && !isMultiline() ? Utils::String::replace(text, "\n", " ") : text) + .size()); } }