aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--doc/ScintillaHistory.html4
-rw-r--r--lexers/LexBatch.cxx25
2 files changed, 19 insertions, 10 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index 3ce1f8bf8..14d394938 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -568,6 +568,10 @@
<a href="https://sourceforge.net/p/scintilla/feature-requests/1347/">Feature #1347</a>.
</li>
<li>
+ Fixed bug in Batch lexer where a single character line with a single character line end continued
+ state onto the next line.
+ </li>
+ <li>
Added SCE_ERR_GCC_EXCERPT style for GCC 9 diagnostics in errorlist lexer.
</li>
<li>
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;