Closed latafy closed 5 months ago
Can you provide a sample showing the problem behavior?
this is a sample showing the StyleNeeded with multiple functions, even after the first function finishes the styling. Setting the scintilla.LexerName
to a valid lexer such as "python" will not allow you to run the added functions anymore on a styleneeded event.
scintilla.LexerName = string.Empty; //replace with python and below functions are obsolete
scintilla.StyleNeeded += (s, se) =>
{
var startPos = scintilla.GetEndStyled();
var endPos = se.Position;
Debug.WriteLine("first" + startPos.ToString() + " " + endPos.ToString());
//can do whatever here
scintilla.StartStyling(endPos + 1);
};
scintilla.StyleNeeded += (s, se) =>
{
var startPos = scintilla.GetEndStyled(); //this should already be the end
var endPos = se.Position;
Debug.WriteLine("second " + startPos.ToString() + " " + endPos.ToString());
//can do whatever here
//scintilla.StartStyling(endPos + 1); //dont need
};
Thank you for the sample, I will look into this and let you know what I can figure out.
I'm pretty sure StyleNeeded only works with an empty container, so this seems by design and setting the LexerName to anything else will cause the event to stop being used.
Closing for now, but if this does not answer your question, re-activate the issue.
Is there any way to add functions to the StyleNeeded event when there is a LexerName such as "python" present? It seems to be possible to add multiple functions for this event when there is no lexer being used, but it does not work no matter what I tried if there is a built in lexer being used already.