aboutsummaryrefslogtreecommitdiffhomepage
path: root/lexers/LexBatch.cxx
diff options
context:
space:
mode:
authorYury Dubinsky <unknown>2020-05-05 08:35:48 +1000
committerYury Dubinsky <unknown>2020-05-05 08:35:48 +1000
commitb501aa00d3f8a5d4f4b97e13243612c8952ca60a (patch)
treea6e969a64b129cc840a4697a0e4e250472629f1a /lexers/LexBatch.cxx
parent187d3e058cc49b94f34ab88358bc0800dc7ca74c (diff)
downloadscintilla-mirror-b501aa00d3f8a5d4f4b97e13243612c8952ca60a.tar.gz
Fixed bug where a single character line with a single character line end
continued state onto the next line.
Diffstat (limited to 'lexers/LexBatch.cxx')
-rw-r--r--lexers/LexBatch.cxx25
1 files changed, 15 insertions, 10 deletions
diff --git a/lexers/LexBatch.cxx b/lexers/LexBatch.cxx
index ee71c528f..857b60ce6 100644
--- a/lexers/LexBatch.cxx
+++ b/lexers/LexBatch.cxx
@@ -543,17 +543,22 @@ static void ColouriseBatchDoc(
// Colorize Default Text for remainder of line - currently not lexed
styler.ColourTo(endPos, SCE_BAT_DEFAULT);
- // handle line continuation for SET and ECHO commands except the last line and an empty line
- if (!continueProcessing && (i<startPos + length-1) && linePos>2) {
- Sci_PositionU lineContinuationPos;
- if (lineBuffer[linePos-2]=='\r') // Windows EOL
- lineContinuationPos=linePos-3;
- else
- lineContinuationPos=linePos-2; // Unix or Mac EOL
- if ((lineBuffer[lineContinuationPos]!='^') || // handle '^' line continuation
- IsEscaped(lineBuffer, lineContinuationPos)
- || textQuoted(lineBuffer, lineContinuationPos))
+ // handle line continuation for SET and ECHO commands except the last line
+ if (!continueProcessing && (i<startPos + length-1)) {
+ if (linePos==1 || (linePos==2 && lineBuffer[1]=='\r')) // empty line on Unix and Mac or on Windows
+ continueProcessing=true;
+ else {
+ Sci_PositionU lineContinuationPos;
+ if ((linePos>2) && lineBuffer[linePos-2]=='\r') // Windows EOL
+ lineContinuationPos=linePos-3;
+ else
+ lineContinuationPos=linePos-2; // Unix or Mac EOL
+ // Reset continueProcessing if line continuation was not found
+ if ((lineBuffer[lineContinuationPos]!='^')
+ || IsEscaped(lineBuffer, lineContinuationPos)
+ || textQuoted(lineBuffer, lineContinuationPos))
continueProcessing=true;
+ }
}
linePos = 0;