From bb56e9dd9ff4b93c910bd1d72fb6cdba31be3ea9 Mon Sep 17 00:00:00 2001 From: Andrey Lihatskiy Date: Mon, 12 Jan 2026 06:20:24 +0200 Subject: #5278 Async syntax apply in slices to avoid UI stalls --- indra/newview/llscripteditor.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'indra/newview/llscripteditor.h') diff --git a/indra/newview/llscripteditor.h b/indra/newview/llscripteditor.h index 1ca26fbcc9..dcbfdf3085 100644 --- a/indra/newview/llscripteditor.h +++ b/indra/newview/llscripteditor.h @@ -29,6 +29,7 @@ #define LL_SCRIPTEDITOR_H #include "lltexteditor.h" +#include class LLScriptEditor : public LLTextEditor { @@ -64,14 +65,29 @@ public: protected: friend class LLUICtrlFactory; + friend class LLScriptEditorSyntaxWorker; LLScriptEditor(const Params& p); private: + enum class SyntaxApplyState + { + Idle, + Building, + Inserting + }; void drawLineNumbers(); void updateSegments() override; void drawSelectionBackground() override; void ensureSyntaxWorker(); void queueSyntaxParse(); + void queueSyntaxApply(LLWString text, + LLKeywords::segment_ops_t ops, + S32 text_generation, + U32 keywords_generation, + bool disable_highlight, + LLKeywords* keywords); + void processPendingSyntaxApply(); + void resetPendingSyntaxApply(); LLKeywords mKeywordsLua; LLKeywords mKeywordsLSL; @@ -85,6 +101,18 @@ private: bool mLastQueuedDisableHighlight; LLKeywords* mLastQueuedKeywords; class LLScriptEditorSyntaxWorker* mSyntaxWorker; + SyntaxApplyState mSyntaxApplyState; + LLWString mPendingApplyText; + LLKeywords::segment_ops_t mPendingApplyOps; + segment_vec_t mPendingApplySegments; + segment_set_t mPendingApplySegmentSet; + size_t mPendingApplyOpIndex; + size_t mPendingApplySegmentIndex; + LLStyleConstSP mPendingApplyStyle; + S32 mPendingApplyTextGeneration; + U32 mPendingApplyKeywordsGeneration; + bool mPendingApplyDisableHighlight; + LLKeywords* mPendingApplyKeywords; }; #endif // LL_SCRIPTEDITOR_H -- cgit v1.3