aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/StyleContext.h
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2002-02-11 02:15:56 +0000
committernyamatongwe <devnull@localhost>2002-02-11 02:15:56 +0000
commitbc4593ab2fd07b59d3709d36ec951d3fbf0e44ff (patch)
tree8fccbc9b0127de0aa755ebbef0a78b4ca1609bad /src/StyleContext.h
parent58a3f8eee17d6d083c09822ea83719980fbb2b3e (diff)
downloadscintilla-mirror-bc4593ab2fd07b59d3709d36ec951d3fbf0e44ff.tar.gz
Changes to tighten up styling beyond the bounds of the document.
May not be permanent.
Diffstat (limited to 'src/StyleContext.h')
-rw-r--r--src/StyleContext.h38
1 files changed, 23 insertions, 15 deletions
diff --git a/src/StyleContext.h b/src/StyleContext.h
index 343c81972..9e803c4a7 100644
--- a/src/StyleContext.h
+++ b/src/StyleContext.h
@@ -55,25 +55,33 @@ public:
styler.ColourTo(currentPos - 1, state);
}
bool More() {
- return currentPos <= endPos;
+ return currentPos < endPos;
}
void Forward() {
- atLineStart = atLineEnd;
- // A lot of this is repeated from the constructor - TODO: merge code
- chPrev = ch;
- currentPos++;
- if (ch >= 0x100)
+ if (currentPos < endPos) {
+ atLineStart = atLineEnd;
+ // A lot of this is repeated from the constructor - TODO: merge code
+ chPrev = ch;
currentPos++;
- ch = chNext;
- chNext = static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+1));
- if (styler.IsLeadByte(static_cast<char>(chNext))) {
- chNext = chNext << 8;
- chNext |= static_cast<unsigned char>(styler.SafeGetCharAt(currentPos + 2));
+ if (ch >= 0x100)
+ currentPos++;
+ ch = chNext;
+ chNext = static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+1));
+ if (styler.IsLeadByte(static_cast<char>(chNext))) {
+ chNext = chNext << 8;
+ chNext |= static_cast<unsigned char>(styler.SafeGetCharAt(currentPos + 2));
+ }
+ // Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix)
+ // Avoid triggering two times on Dos/Win
+ // End of line
+ atLineEnd = (ch == '\r' && chNext != '\n') || (ch == '\n') || (currentPos >= endPos);
+ } else {
+ atLineStart = false;
+ chPrev = ' ';
+ ch = ' ';
+ chNext = ' ';
+ atLineEnd = true;
}
- // Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix)
- // Avoid triggering two times on Dos/Win
- // End of line
- atLineEnd = (ch == '\r' && chNext != '\n') || (ch == '\n') || (currentPos >= endPos);
}
void ChangeState(int state_) {
state = state_;