https://bugs.kde.org/show_bug.cgi?id=378487
Bug ID: 378487
Summary: Incorrect termination of \iffalse comment for latex
highlight
Product: kate
Version: Git
Platform: openSUSE RPMs
OS: Linux
Status: UNCONFIRMED
Severity: normal
Priority: NOR
Component: syntax
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
The latex.xml syntax highlight file contains the following snippets of code for
identifying a multiline comment obtained by means of \iffalse ... \fi:
<StringDetect String="\iffalse" attribute="Comment" context="Multiline
Comment"/>
<context name="Multiline Comment" attribute="Comment" lineEndContext="#stay">
<StringDetect String="\fi" attribute="Comment" context="#pop"/>
<StringDetect String="\else" attribute="Comment" context="#pop"/>
</context>
It induces the correct highlighting in several cases, except when the part of
text between \iffalse and \fi contains a command starting with "\fi", like
\fill.
In such a case, the comment highlighting stops at \fi of \fill and this may
cause a completely wrong highlighting of the remaining part of the text, in
particular when this happens inside a math mode.
A possible fix for this situation is to replace the code
<context name="Multiline Comment" attribute="Comment" lineEndContext="#stay">
<StringDetect String="\fi" attribute="Comment" context="#pop"/>
<StringDetect String="\else" attribute="Comment" context="#pop"/>
</context>
with
<context name="Multiline Comment" attribute="Comment" lineEndContext="#stay">
<RegExpr String="\\fi([^a-zA-Z]|$)" attribute="Comment"
context="#pop"/>
<RegExpr String="\\else([^a-zA-Z]|$)" attribute="Comment"
context="#pop"/>
</context>
which prevents to match \fi and \else as termination of the multiline comment
when they occur as prefix of another command (like \fi in \fill).
The fix has been checked with kile 2.1.3 and kate 3.14.9 in openSUSE 13.2 as
well as with kate 16.08.2 in openSUSE Leap 42.2; the shipped syntax file is the
same as the one in the git repository, so it should apply there as well.
--
You are receiving this mail because:
You are watching all bug changes.