summaryrefslogtreecommitdiff
path: root/indra/llui/llkeywords.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2025-05-07 18:14:50 +0300
committerAndrey Lihatskiy <alihatskiy@productengine.com>2025-05-07 18:14:50 +0300
commit0787d4102ed5502e314a51d00ccf21d9acaca4f1 (patch)
tree8b34ee2fd8a3a37c016f44209c7d814edfdd5376 /indra/llui/llkeywords.cpp
parent9f73e81065ec0e9e4fb21f28e29b9a28a857e63f (diff)
Add "ScriptEditorDisableSyntaxHighlight" debug setting
Diffstat (limited to 'indra/llui/llkeywords.cpp')
-rw-r--r--indra/llui/llkeywords.cpp17
1 files changed, 16 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