From 7118d8f892a0b62a8ac09ad36b06e080aaa53cea Mon Sep 17 00:00:00 2001 From: mitchell Date: Wed, 17 Jun 2020 21:31:53 -0400 Subject: Backport: Feature [feature-requests:1358]. Support lstlisting environment that is similar to verbatim. Backport of changeset 8293:ad96f0ae7df5. --- doc/ScintillaHistory.html | 5 +++++ lexers/LexLaTeX.cxx | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 898eb6d4c..f572606af 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -547,6 +547,7 @@ McLoo Chris Graham + Hugues Larrive

@@ -591,6 +592,10 @@ Bug #2019.

  • + The latex lexer supports lstlisting environment that is similar to verbatim. + Feature #1358. +
  • +
  • Fixed bug with GTK on recent Linux distributions where underscores were invisible. Bug #2173.
  • diff --git a/lexers/LexLaTeX.cxx b/lexers/LexLaTeX.cxx index 496d04177..4b6cbdc6e 100644 --- a/lexers/LexLaTeX.cxx +++ b/lexers/LexLaTeX.cxx @@ -305,6 +305,8 @@ void SCI_METHOD LexerLaTeX::Lex(Sci_PositionU startPos, Sci_Position length, int latexStateReset(mode, state); if (latexLastWordIs(i, styler, "{verbatim}")) { state = SCE_L_VERBATIM; + } else if (latexLastWordIs(i, styler, "{lstlisting}")) { + state = SCE_L_VERBATIM; } else if (latexLastWordIs(i, styler, "{comment}")) { state = SCE_L_COMMENT2; } else if (latexLastWordIs(i, styler, "{math}") && mode == 0) { @@ -453,6 +455,9 @@ void SCI_METHOD LexerLaTeX::Lex(Sci_PositionU startPos, Sci_Position length, int if (latexLastWordIs(match, styler, "{verbatim}")) { styler.ColourTo(i - 1, state); state = SCE_L_COMMAND; + } else if (latexLastWordIs(match, styler, "{lstlisting}")) { + styler.ColourTo(i - 1, state); + state = SCE_L_COMMAND; } } } -- cgit v1.2.3