From 48c1d7f134027923dca421c4db45e6198b50f5c2 Mon Sep 17 00:00:00 2001 From: Miezhiko <Miezhiko@gmail.com> Date: Wed, 22 Sep 2021 17:16:07 +0400 Subject: [PATCH] Make shift+enter to newline on all chat windows + handling fix Signed-off-by: Miezhiko <Miezhiko@gmail.com> --- indra/llui/lltexteditor.cpp | 12 ++++++++++++ indra/llui/lltexteditor.h | 1 - indra/newview/llfloaterimnearbychat.cpp | 14 -------------- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 8c6792bd717..217aec38e27 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -1784,6 +1784,18 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask) autoIndent(); } } + else if (mask == MASK_SHIFT) + { + if( mCursorPos > 0 ) + { + const LLWString& text = getWText(); + if( '\n' != text[ mCursorPos - 1 ] ) + { + addLineBreakChar(); + handled = TRUE; + } + } + } else { handled = FALSE; diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index 7d77c1bacd8..c7c024cdb47 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -213,7 +213,6 @@ class LLTextEditor : bool getShowContextMenu() const { return mShowContextMenu; } void setPassDelete(BOOL b) { mPassDelete = b; } - void handleNewLine() { addLineBreakChar(FALSE); } protected: void showContextMenu(S32 x, S32 y); diff --git a/indra/newview/llfloaterimnearbychat.cpp b/indra/newview/llfloaterimnearbychat.cpp index fb2557b80cd..49937cedefa 100644 --- a/indra/newview/llfloaterimnearbychat.cpp +++ b/indra/newview/llfloaterimnearbychat.cpp @@ -426,20 +426,6 @@ BOOL LLFloaterIMNearbyChat::handleKeyHere( KEY key, MASK mask ) sendChat(CHAT_TYPE_SHOUT); handled = TRUE; } - else if (KEY_RETURN == key && mask == MASK_SHIFT) - { - // newline - if (mInputEditor) - { - // but don't allow multiple new lines - LLWString raw_text = mInputEditor->getWText(); - if (raw_text[raw_text.length() - 1] != '\n') - { - mInputEditor->handleNewLine(); - } - } - handled = TRUE; - } if((mask == MASK_ALT) && isTornOff()) { -- GitLab