From d45c18171d358d27f0a9f9f79bd95ea3b3ddf58c Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Sun, 24 Dec 2023 15:29:44 -0500
Subject: [PATCH] Fix various annoying bugs in nearby chat chui

---
 indra/newview/llfloaterimnearbychat.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/indra/newview/llfloaterimnearbychat.cpp b/indra/newview/llfloaterimnearbychat.cpp
index 6d2dc6d4b13..71e62e5694d 100644
--- a/indra/newview/llfloaterimnearbychat.cpp
+++ b/indra/newview/llfloaterimnearbychat.cpp
@@ -295,7 +295,7 @@ void LLFloaterIMNearbyChat::setVisible(BOOL visible)
 {
 	LLFloaterIMSessionTab::setVisible(visible);
 
-	if(visible)
+	if(visible && isMessagePaneExpanded())
 	{
 		removeScreenChat();
 	}
@@ -306,7 +306,7 @@ void LLFloaterIMNearbyChat::setVisibleAndFrontmost(BOOL take_focus, const LLSD&
 {
 	LLFloaterIMSessionTab::setVisibleAndFrontmost(take_focus, key);
 
-	if(matchesKey(key))
+	if(!isTornOff() && matchesKey(key))
 	{
 		LLFloaterIMContainer::getInstance()->selectConversationPair(mSessionID, true, take_focus);
 	}
@@ -632,6 +632,10 @@ void LLFloaterIMNearbyChat::sendChat( EChatType type )
 	if (gSavedSettings.getBOOL("CloseChatOnReturn"))
 	{
 		stopChat();
+		if (isTornOff())
+		{
+			closeHostedFloater();
+		}
 	}
 }
 
-- 
GitLab