From 4d98974ad3e018c5faedaba125b40ea4d7e4f87c Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Wed, 9 Oct 2019 09:42:43 +0200 Subject: [PATCH] + fix: batch lexer: handle comment after ampersand(&) command sequence --- Versions/build.txt | 2 +- res/Notepad3.exe.manifest.conf | 2 +- scintilla/lexers/LexBatch.cxx | 25 ++++++++++++++++++++++++- src/VersionEx.h | 6 +++--- 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/Versions/build.txt b/Versions/build.txt index 5450f98e8..5a1eaeaeb 100644 --- a/Versions/build.txt +++ b/Versions/build.txt @@ -1 +1 @@ -2657 +2658 diff --git a/res/Notepad3.exe.manifest.conf b/res/Notepad3.exe.manifest.conf index 4d0077edc..754fa11d4 100644 --- a/res/Notepad3.exe.manifest.conf +++ b/res/Notepad3.exe.manifest.conf @@ -3,7 +3,7 @@ Notepad3 BETA diff --git a/scintilla/lexers/LexBatch.cxx b/scintilla/lexers/LexBatch.cxx index b641fc86d..aff3f4661 100644 --- a/scintilla/lexers/LexBatch.cxx +++ b/scintilla/lexers/LexBatch.cxx @@ -137,6 +137,29 @@ static void ColouriseBatchLine( styler.ColourTo(endPos, SCE_BAT_COMMENT); return; } + else if ((wbl > 2) && (wordBuffer[0] == '&') && (wordBuffer[1] == ':') && (wordBuffer[2] == ':') && (continueProcessing)) { + styler.ColourTo(endPos, SCE_BAT_COMMENT); + return; + } + else if (wordBuffer[0] == '&') { + // check for comment + Sci_PositionU cmntLoc = offset - wbl + 1; + // Skip next spaces + while ((cmntLoc < lengthLine) && + (isspacechar(lineBuffer[cmntLoc]))) { + cmntLoc++; + } + int p = 0; + char buffer[5]; + while ((cmntLoc < lengthLine) && (p < 4)) { + buffer[p++] = lineBuffer[cmntLoc++]; + } + buffer[p] = '\0'; + if ((((buffer[0] == ':') && (buffer[1] == ':')) || (CompareCaseInsensitive(buffer, "rem ") == 0)) && (continueProcessing)) { + styler.ColourTo(endPos, SCE_BAT_COMMENT); + return; + } + } // Check for Separator if (IsBSeparator(wordBuffer[0])) { // Check for External Command / Program @@ -147,7 +170,7 @@ static void ColouriseBatchLine( // Reset Offset to re-process remainder of word offset -= (wbl - 1); // Colorize External Command / Program - if (!keywords2) { + if (!keywords2) { styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND); } else if (keywords2.InList(wordBuffer)) { styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND); diff --git a/src/VersionEx.h b/src/VersionEx.h index 81c47b4a5..435e9be43 100644 --- a/src/VersionEx.h +++ b/src/VersionEx.h @@ -7,10 +7,10 @@ #define SAPPNAME "Notepad3" #define VERSION_MAJOR 5 #define VERSION_MINOR 19 -#define VERSION_REV 1001 -#define VERSION_BUILD 2657 +#define VERSION_REV 1009 +#define VERSION_BUILD 2658 #define SCINTILLA_VER 420 -#define ONIGURUMA_REGEX_VER 6.9.3 +#define ONIGURUMA_REGEX_VER 6.9.4 #define UCHARDET_VER 2018.09.27 #define TINYEXPR_VER 2018.05.11 #define UTHASH_VER 2.1.0