Skip to content

Commit

Permalink
fix: highlight of \iffalse
Browse files Browse the repository at this point in the history
The contents after \else should not be highlighted as a comment
ref: lervag#1988
  • Loading branch information
julio-b committed Feb 1, 2022
1 parent 7e9102b commit 15a242e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion autoload/vimtex/syntax/core.vim
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ function! vimtex#syntax#core#init() abort " {{{1

" Highlight \iffalse ... \fi blocks as comments
syntax region texComment matchgroup=texCmd
\ start="^\s*\\iffalse\>" end="\\fi\>"
\ start="^\s*\\iffalse\>" end="\\\(fi\|else\)\>"
\ contains=texCommentConditionals
syntax region texCommentConditionals matchgroup=texComment
\ start="\\if\w\+" end="\\fi\>"
Expand Down
13 changes: 13 additions & 0 deletions test/test-syntax/test-iffalse.tex
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
\iffalse
Commented stuff
Another \ifstuff here \fi
\ifaa \else \fi
\ifasd \fi \f \fii

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
Expand All @@ -19,4 +20,16 @@
gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
\fi

\iffalse
Commented stuff
Another \ifstuff here \fi
\ifaa \else \fi
\ifasd \fi \f \fii
\else
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd
gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
\fi

\end{document}

0 comments on commit 15a242e

Please sign in to comment.