[QScintilla] Resetting a lexer resets margin font?

Phil Thompson phil at riverbankcomputing.com
Thu Apr 9 17:59:26 BST 2020


On 09/04/2020 17:51, Matic Kukovec wrote:
> From: Phil Thompson <phil at riverbankcomputing.com>
> Sent: Monday, April 6, 2020 12:45 PM
> To: Matic Kukovec <kukovecmatic at hotmail.com>
> Cc: QScintilla <qscintilla at riverbankcomputing.com>
> Subject: Re: [QScintilla] Resetting a lexer resets margin font?
> 
> On 29/03/2020 21:11, Matic Kukovec wrote:
>> Hi guys,
>> 
>> In the example in the attachment (lexer_change.py) when reseting the
>> lexer of the QSciScintilla editor
>> by pressing the button RESET LEXER on the top, the margin font gets
>> reset to the default and brace matching
>> becomes weird (the braces move to the left when the cursor is on a
>> brace-pair).
>> 
>> In the attached example this happens always, but I have code where
>> this does not happen, but the code is more or less the same.
>> Am I missing something or is this a bug?
>> 
>> Specs:
>> Windows 10
>> PyQt 5.14.0 or PyQt 5.14.1
>> QScintilla 2.11.4
> 
> When a new lexer is set a lot of (apparently lexer-independent) state
> gets reset. This is a feature of the underlying Scintilla
> implementation.
> 
> Phil
> Thank you Phil, I did not know that.
> 
> The problem is not restyling the margin font after this happens, it's
> the brace matching that I don't know how to reset back to the normal
> style?
> This is what happens:
> [cid:d60c6c80-379f-4205-9d39-f7c799947769]
> 
> How do I switch the brace style back to the first one in the above
> animation? The first one is the slightly thicker braces, before the
> button press.

You probably have to use the underlying Scintilla calls. I can't see why 
you would ever want to replace an existing lexer.

Phil


More information about the QScintilla mailing list