diff options
author | nyamatongwe <unknown> | 2005-05-04 10:35:09 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2005-05-04 10:35:09 +0000 |
commit | 47ee55630c4942e72b93b35d48ffcb7689fb8b7c (patch) | |
tree | b774b389e45650bc94a0f8594f7f724807ef593d | |
parent | c9679fdbc33797659762c88bd396aef4ec9c4e1d (diff) | |
download | scintilla-mirror-47ee55630c4942e72b93b35d48ffcb7689fb8b7c.tar.gz |
Avoid writing styles beyond end of document.
-rw-r--r-- | src/LexCaml.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/LexCaml.cxx b/src/LexCaml.cxx index 5729dd244..c3f47af33 100644 --- a/src/LexCaml.cxx +++ b/src/LexCaml.cxx @@ -10,6 +10,7 @@ 20050206 Added cast for IsLeadByte(). 20050209 Changes to "external" build support. 20050306 Fix for 1st-char-in-doc "corner" case. + 20050502 Fix for [harmless] one-past-the-end coloring. */ #include <stdlib.h> @@ -180,7 +181,8 @@ void ColouriseCamlDoc( // foreach char in range... unsigned int i = startPos; - for (unsigned int endPos = startPos + length; i < endPos; i += chSkip) { + const unsigned int endPos = startPos + length; + for (; i < endPos; i += chSkip) { // set up [per-char] state info int ch = chNext; chNext = static_cast<unsigned char>(styler.SafeGetCharAt(i + 1)); @@ -362,7 +364,9 @@ void ColouriseCamlDoc( chLast = ch; } - // do terminal char coloring (JIC) + // do any required terminal char coloring (JIC) + if (i >= endPos) + i = endPos - 1; styler.ColourTo(i, state); // styler.Flush(); // (is this always done by calling code?) } |