diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp
index fd4ef33f59e76e546ef7dd694f904081e26cfe59..c5e8f76a7348ff9b2a2ad3fc2cf9ae0d5c4d0957 100755
--- a/indra/llui/llkeywords.cpp
+++ b/indra/llui/llkeywords.cpp
@@ -128,6 +128,16 @@ void LLKeywords::addToken(LLKeywordToken::TOKEN_TYPE type,
 	}
 }
 
+void LLKeywords::clear()
+{
+	clearLoaded();
+	mSyntax = LLSD();
+
+	std::for_each(mWordTokenMap.begin(), mWordTokenMap.end(), DeletePairedPointer());
+	std::for_each(mLineTokenList.begin(), mLineTokenList.end(), DeletePointer());
+	std::for_each(mDelimiterTokenList.begin(), mDelimiterTokenList.end(), DeletePointer());
+}
+
 std::string LLKeywords::getArguments(LLSD& arguments)
 {
 	std::string argString = "";
@@ -326,7 +336,6 @@ void LLKeywords::processTokensGroup(LLSD& Tokens, const std::string Group)
 			{
 				Color = ColorGroup;
 				mAttributes.clear();
-				bool deprecated = false;
 				LLSD arguments = LLSD ();
 				LLSD::map_iterator innerIt = outerIt->second.beginMap();
 				for ( ; innerIt != outerIt->second.endMap(); ++innerIt)
diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h
index 689fd75bcd7c8ce1a81106f36242e8c4c6359ddf..de7645a5d29b66f69a51df6d4c2f31e7d86a7ab4 100755
--- a/indra/llui/llkeywords.h
+++ b/indra/llui/llkeywords.h
@@ -110,6 +110,7 @@ class LLKeywords
 	~LLKeywords();
 
 	void		addColorGroup(const std::string key_in, const LLColor4 color);
+	void		clear();
 	void		clearLoaded() { mLoaded = false; }
 	LLColor4	getColorGroup(const std::string key_in);
 	bool		isLoaded() const	{ return mLoaded; }
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index 303bc4893383bcd05df004c370562b5b4006ae53..e11636682ee3d2de75c56c667a46287698b9eb3a 100755
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -2529,6 +2529,14 @@ void LLTextEditor::loadKeywords()
 	}
 }
 
+void LLTextEditor::clearSegments()
+{
+	if (!mSegments.empty())
+	{
+		mSegments.clear();
+	}
+}
+
 void LLTextEditor::updateSegments()
 {
 	if (mReflowIndex < S32_MAX && mKeywords.isLoaded() && mParseOnTheFly)
diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h
index d7f6c7f643d7d01acdf614e1f5f5f98c9e665550..698153587f2adeaacbe374f3943459d937884fa4 100755
--- a/indra/llui/lltexteditor.h
+++ b/indra/llui/lltexteditor.h
@@ -207,7 +207,8 @@ class LLTextEditor :
 	const LLUUID&	getSourceID() const						{ return mSourceID; }
 
 	const LLTextSegmentPtr	getPreviousSegment() const;
-	void getSelectedSegments(segment_vec_t& segments) const;
+	void			getSelectedSegments(segment_vec_t& segments) const;
+	void			clearSegments();
 
 	void			setShowContextMenu(bool show) { mShowContextMenu = show; }
 	bool			getShowContextMenu() const { return mShowContextMenu; }