When the HTML/PHP/XML lexer resumes on styles
SCE_H_ASP, it breaks.
This is specifically visible with this example (from https://github.com/geany/geany/issues/1143):
<p>Paragraph 1</p> <?php function("1 2", 'sql') ?> <p>Paragraph 2</p>
Doing anything that leads for styling to resume at the start of line 3 (
<?php...) will break highlighting of the part after
?>. adding a line break in either of the PHP strings is such a thing.
This is because when resuming inside a string, the lexer moves back to the start of the previous line not starting in a string. This is position 0 on line 3, which has style
SCE_H_QUESTION. This leads to start with this style, but unfortunately no code is ever handing going out of this style, that is supposed to only be set once and never reached. Hence, when the code resumes the non-script style, it resules in state
SCE_H_QUESTION, and never leaves it.
Attached patch alters the initial style when it is one of those for which getting out is never handled and restes it to default style. The resumed lexing will be all fine, because it'll re-lex it, and because those styles never span multiple lines and the lexer always resume at a line start.
Log in to post a comment.