diff options
| author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2025-05-07 18:14:50 +0300 |
|---|---|---|
| committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2025-05-07 18:14:50 +0300 |
| commit | 0787d4102ed5502e314a51d00ccf21d9acaca4f1 (patch) | |
| tree | 8b34ee2fd8a3a37c016f44209c7d814edfdd5376 | |
| parent | 9f73e81065ec0e9e4fb21f28e29b9a28a857e63f (diff) | |
Add "ScriptEditorDisableSyntaxHighlight" debug setting
| -rw-r--r-- | indra/llui/llkeywords.cpp | 17 | ||||
| -rw-r--r-- | indra/newview/app_settings/settings.xml | 11 |
2 files changed, 27 insertions, 1 deletions
diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index bec9819cde..0ec8f74c25 100644 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -34,6 +34,9 @@ #include "llsdserialize.h" #include "lltexteditor.h" #include "llstl.h" +#include "llcontrol.h" + +extern LLControlGroup gSavedSettings; inline bool LLKeywordToken::isHead(const llwchar* s) const { @@ -503,13 +506,14 @@ LLTrace::BlockTimerStatHandle FTM_SYNTAX_COLORING("Syntax Coloring"); void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLWString& wtext, LLTextEditor& editor, LLStyleConstSP style) { LL_RECORD_BLOCK_TIME(FTM_SYNTAX_COLORING); - seg_list->clear(); if( wtext.empty() ) { return; } + // Clear the segment list + seg_list->clear(); // Reserve capacity for segments based on an estimated average of 8 characters per segment. constexpr size_t AVERAGE_SEGMENT_LENGTH = 8; seg_list->reserve(wtext.size() / AVERAGE_SEGMENT_LENGTH); @@ -591,6 +595,17 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW cur++; } + // Check if syntax highlighting is disabled + static LLCachedControl<bool> sDisableSyntaxHighlighting(gSavedSettings, "ScriptEditorDisableSyntaxHighlight", false); + if (sDisableSyntaxHighlighting) + { + if (*cur && *cur != '\n') + { + cur++; + } + continue; // skip processing any further syntax highlighting + } + while( *cur && *cur != '\n' ) { // Check for regex matches first diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 07298fa921..df6ce3125f 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -16091,5 +16091,16 @@ <key>Value</key> <integer>1</integer> </map> + <key>ScriptEditorDisableSyntaxHighlight</key> + <map> + <key>Comment</key> + <string>Disable syntax highlighting in script editor for performance testing</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> </map> </llsd> |
