Because the highlighting I want to use is needed to get the previous status of store in a variable in the previous line, and I can use it in the QSyntaxHighlighter by store it in setCurrentBlockState.
For example:
from PyQt5.Qsci import QsciScintilla
class QsciLexerCustom1(QsciLexerCustom):
def styleText(self, start, end):
editor = self.editor()
SCI = editor.SendScintilla
interline_status = 0
for line in source:
#(tokenizing the line)
for token in tokenized_line:
if token == "string1":
interline_status = 1
if token == "string2":
interline_status = 2
However, the interline_status
will be reset to 0 while processing to the next line. I have found the variable QsciScintilla.SCI_GETSTYLEAT
which is similar to what I want like below:
pos = SCI(QsciScintilla.SCI_GETLINEENDPOSITION, index - 1)
interline_state = SCI(QsciScintilla.SCI_GETSTYLEAT, pos)
However, the result is unexpected. Maybe the status value I want to use is not at the end of the variable.
Is there any equivalent of setCurrentBlockState
in QsciScintilla (in PyQt5)?
source https://stackoverflow.com/questions/67762672/is-there-any-equivelant-of-setcurrentblockstate-of-qsyntaxhighlighter-in-qscisci
Comments
Post a Comment