aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornyamatongwe <unknown>2006-09-09 00:06:14 +0000
committernyamatongwe <unknown>2006-09-09 00:06:14 +0000
commit8f0b7b124d19357c179351542ccd89d5b65e372b (patch)
tree50a32db8c4a57fd6d36ba5edf10339aa732d117b /src
parent6dfccdaa299169b8425267a93a336cf7b43debee (diff)
downloadscintilla-mirror-8f0b7b124d19357c179351542ccd89d5b65e372b.tar.gz
Patch from Snow that avoids hang with file that ends with %%.
Diffstat (limited to 'src')
-rw-r--r--src/LexOthers.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/LexOthers.cxx b/src/LexOthers.cxx
index 5f6e7e404..0731572c4 100644
--- a/src/LexOthers.cxx
+++ b/src/LexOthers.cxx
@@ -125,7 +125,7 @@ static void ColouriseBatchLine(
styler.ColourTo(startLine + offset + 1, SCE_BAT_IDENTIFIER);
offset += 2;
// Check for External Command / Program
- if (!isspacechar(lineBuffer[offset])) {
+ if (offset < lengthLine && !isspacechar(lineBuffer[offset])) {
cmdLoc = offset;
}
// Check for Environment Variable (%x...%)
@@ -136,7 +136,7 @@ static void ColouriseBatchLine(
styler.ColourTo(startLine + offset, SCE_BAT_IDENTIFIER);
offset++;
// Check for External Command / Program
- if (!isspacechar(lineBuffer[offset])) {
+ if (offset < lengthLine && !isspacechar(lineBuffer[offset])) {
cmdLoc = offset;
}
}
@@ -371,6 +371,7 @@ static void ColouriseBatchLine(
offset -= (wbl - wbo);
// Check for Local Variable (%%a)
} else if (
+ (wbl > 2) &&
(wordBuffer[1] == '%') &&
(wordBuffer[2] != '%') &&
(!IsBOperator(wordBuffer[2])) &&
@@ -473,6 +474,7 @@ static void ColouriseBatchDoc(
}
}
if (linePos > 0) { // Last line does not have ending characters
+ lineBuffer[linePos] = '\0';
ColouriseBatchLine(lineBuffer, linePos, startLine, startPos + length - 1,
keywordlists, styler);
}