diff options
-rw-r--r-- | doc/ScintillaHistory.html | 1 | ||||
-rw-r--r-- | src/LexOthers.cxx | 27 |
2 files changed, 28 insertions, 0 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index c5ec27d84..2e33a319b 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -332,6 +332,7 @@ <td>James Moffatt</td> </tr><tr> <td>Yuzhou Xin</td> + <td>Nic Jansma</td> </tr> </table> <p> diff --git a/src/LexOthers.cxx b/src/LexOthers.cxx index 3c6940bfc..1869014f8 100644 --- a/src/LexOthers.cxx +++ b/src/LexOthers.cxx @@ -213,6 +213,7 @@ static void ColouriseBatchLine( // No need to Reset Offset // Check for Special Keyword in list, External Command / Program, or Default Text } else if ((wordBuffer[0] != '%') && + (wordBuffer[0] != '!') && (!IsBOperator(wordBuffer[0])) && (continueProcessing)) { // Check for Special Keyword @@ -249,6 +250,7 @@ static void ColouriseBatchLine( // Read up to %, Operator or Separator while ((wbo < wbl) && (wordBuffer[wbo] != '%') && + (wordBuffer[wbo] != '!') && (!IsBOperator(wordBuffer[wbo])) && (!IsBSeparator(wordBuffer[wbo]))) { wbo++; @@ -298,6 +300,7 @@ static void ColouriseBatchLine( // Read up to %, Operator or Separator while ((wbo < wbl) && (wordBuffer[wbo] != '%') && + (wordBuffer[wbo] != '!') && (!IsBOperator(wordBuffer[wbo])) && (!IsBSeparator(wordBuffer[wbo]))) { wbo++; @@ -370,6 +373,29 @@ static void ColouriseBatchLine( // Reset Offset to re-process remainder of word offset -= (wbl - 3); } + // Check for Environment Variable (!x...!) + } else if (wordBuffer[0] == '!') { + // Colorize Default Text + styler.ColourTo(startLine + offset - 1 - wbl, SCE_BAT_DEFAULT); + wbo++; + // Search to end of word for second ! (can be a long path) + while ((wbo < wbl) && + (wordBuffer[wbo] != '!') && + (!IsBOperator(wordBuffer[wbo])) && + (!IsBSeparator(wordBuffer[wbo]))) { + wbo++; + } + if (wordBuffer[wbo] == '!') { + wbo++; + // Check for External Command / Program + if (cmdLoc == offset - wbl) { + cmdLoc = offset - (wbl - wbo); + } + // Colorize Environment Variable + styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_IDENTIFIER); + // Reset Offset to re-process remainder of word + offset -= (wbl - wbo); + } // Check for Operator } else if (IsBOperator(wordBuffer[0])) { // Colorize Default Text @@ -417,6 +443,7 @@ static void ColouriseBatchLine( // Read up to %, Operator or Separator while ((wbo < wbl) && (wordBuffer[wbo] != '%') && + (wordBuffer[wbo] != '!') && (!IsBOperator(wordBuffer[wbo])) && (!IsBSeparator(wordBuffer[wbo]))) { wbo++; |