From 3b401a9996f4b2bda437b08edb23fc3b0b68ed32 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Fri, 10 Jul 2015 15:10:00 +0200 Subject: [PATCH] Fix pasting text containing linefeeds into the chat textbox expands them to multiline although single line mode is set --- indra/llui/llchatentry.cpp | 18 ++++++++++++++++++ indra/llui/llchatentry.h | 3 +++ 2 files changed, 21 insertions(+) diff --git a/indra/llui/llchatentry.cpp b/indra/llui/llchatentry.cpp index b0550be5db..eea5ef99bf 100755 --- a/indra/llui/llchatentry.cpp +++ b/indra/llui/llchatentry.cpp @@ -268,3 +268,21 @@ void LLChatEntry::enableSingleLineMode(bool single_line_mode) mPrevLinesCount = -1; setWordWrap(!single_line_mode); } + + +// Fix linefeed pasting +//virtual +void LLChatEntry::paste() +{ + LLTextEditor::paste(); + + if (mSingleLineMode) + { + S32 cursor_pos = getCursorPos(); + LLWString content = getWText(); + LLWStringUtil::replaceChar(content, '\n', 182); + setWText(content); + setCursorPos(cursor_pos); + } +} +// diff --git a/indra/llui/llchatentry.h b/indra/llui/llchatentry.h index 494024002a..1046cfc79f 100755 --- a/indra/llui/llchatentry.h +++ b/indra/llui/llchatentry.h @@ -71,6 +71,9 @@ public: // Changed to public so we can update history when using modifier keys void updateHistory(); + // Fix linefeed pasting + /*virtual*/ void paste(); + private: /**