aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornyamatongwe <unknown>2002-02-15 10:58:32 +0000
committernyamatongwe <unknown>2002-02-15 10:58:32 +0000
commit45edb80fdd1f678613323c57ef2c2cb9f593c771 (patch)
tree38ce2d830190fe5230e7e57c26da09475aca04ad /src
parent18bac0b585d4298a534e8bc50ef99f9f17332162 (diff)
downloadscintilla-mirror-45edb80fdd1f678613323c57ef2c2cb9f593c771.tar.gz
Fixed out of bounds styling.
Diffstat (limited to 'src')
-rw-r--r--src/LexOthers.cxx40
1 files changed, 22 insertions, 18 deletions
diff --git a/src/LexOthers.cxx b/src/LexOthers.cxx
index 2c3998e7b..5e3da2d0a 100644
--- a/src/LexOthers.cxx
+++ b/src/LexOthers.cxx
@@ -201,26 +201,30 @@ static void ColourisePropsLine(
unsigned int i = 0;
while (isspacechar(lineBuffer[i]) && (i < lengthLine)) // Skip initial spaces
i++;
- if (lineBuffer[i] == '#' || lineBuffer[i] == '!' || lineBuffer[i] == ';') {
- styler.ColourTo(endPos, 1);
- } else if (lineBuffer[i] == '[') {
- styler.ColourTo(endPos, 2);
- } else if (lineBuffer[i] == '@') {
- styler.ColourTo(startLine + i, 4);
- if (lineBuffer[++i] == '=')
- styler.ColourTo(startLine + i, 3);
- styler.ColourTo(endPos, 0);
- } else {
- // Search for the '=' character
- while (lineBuffer[i] != '=' && (i < lengthLine - 1))
- i++;
- if (lineBuffer[i] == '=') {
- styler.ColourTo(startLine + i - 1, 0);
- styler.ColourTo(startLine + i, 3);
- styler.ColourTo(endPos-1, 0);
+ if (i < lengthLine) {
+ if (lineBuffer[i] == '#' || lineBuffer[i] == '!' || lineBuffer[i] == ';') {
+ styler.ColourTo(endPos, 1);
+ } else if (lineBuffer[i] == '[') {
+ styler.ColourTo(endPos, 2);
+ } else if (lineBuffer[i] == '@') {
+ styler.ColourTo(startLine + i, 4);
+ if (lineBuffer[++i] == '=')
+ styler.ColourTo(startLine + i, 3);
+ styler.ColourTo(endPos, 0);
} else {
- styler.ColourTo(endPos-1, 0);
+ // Search for the '=' character
+ while (lineBuffer[i] != '=' && (i < lengthLine - 1))
+ i++;
+ if (lineBuffer[i] == '=') {
+ styler.ColourTo(startLine + i - 1, 0);
+ styler.ColourTo(startLine + i, 3);
+ styler.ColourTo(endPos-1, 0);
+ } else {
+ styler.ColourTo(endPos-1, 0);
+ }
}
+ } else {
+ styler.ColourTo(endPos-1, 0);
}
}