diff options
Diffstat (limited to 'indra/llui/lltexteditor.cpp')
-rwxr-xr-x | indra/llui/lltexteditor.cpp | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 62140dd9d6..e11636682e 100755 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -2513,29 +2513,27 @@ BOOL LLTextEditor::tryToRevertToPristineState() static LLFastTimer::DeclareTimer FTM_SYNTAX_HIGHLIGHTING("Syntax Highlighting"); -void LLTextEditor::loadKeywords(const std::string& filename, - const std::vector<std::string>& funcs, - const std::vector<std::string>& tooltips, - const LLColor3& color) +void LLTextEditor::loadKeywords() { LLFastTimer ft(FTM_SYNTAX_HIGHLIGHTING); - if(mKeywords.loadFromFile(filename)) + mKeywords.processTokens(); + + segment_vec_t segment_list; + mKeywords.findSegments(&segment_list, getWText(), mDefaultColor.get(), *this); + + mSegments.clear(); + segment_set_t::iterator insert_it = mSegments.begin(); + for (segment_vec_t::iterator list_it = segment_list.begin(); list_it != segment_list.end(); ++list_it) { - S32 count = llmin(funcs.size(), tooltips.size()); - for(S32 i = 0; i < count; i++) - { - std::string name = utf8str_trim(funcs[i]); - mKeywords.addToken(LLKeywordToken::WORD, name, color, tooltips[i] ); - } - segment_vec_t segment_list; - mKeywords.findSegments(&segment_list, getWText(), mDefaultColor.get(), *this); + insert_it = mSegments.insert(insert_it, *list_it); + } +} +void LLTextEditor::clearSegments() +{ + if (!mSegments.empty()) + { mSegments.clear(); - segment_set_t::iterator insert_it = mSegments.begin(); - for (segment_vec_t::iterator list_it = segment_list.begin(); list_it != segment_list.end(); ++list_it) - { - insert_it = mSegments.insert(insert_it, *list_it); - } } } |