From df2f85d0b71e8644aef71032f98746dc487b2b6d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 1 Sep 2025 17:25:03 +0200 Subject: [PATCH] Do not set the lexer for the map wxSTC instance Apparently using the same lexer for 2 controls sharing the same document doesn't work, this results in problems with syntax highlighting and folding not working at all. Simply not doing this fixes these problems while still showing the correct syntax highlighting in the map, as it shares the same document. --- samples/stc/stctest.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/samples/stc/stctest.cpp b/samples/stc/stctest.cpp index dca55ba487..9a76b15d92 100644 --- a/samples/stc/stctest.cpp +++ b/samples/stc/stctest.cpp @@ -915,7 +915,11 @@ public: edit->SetReadOnly(wasReadOnly); // Copy the main editor attributes. - SetLexer(edit->GetLexer()); + + // Do NOT set the lexer: this somehow breaks syntax highlighting and + // folding in the main editor itself and the map gets syntax + // highlighting even without it anyhow. + for ( int style = 0; style < wxSTC_STYLE_MAX; ++style ) { // There is probably no need to set the font for the map: at such