diff options
author | nyamatongwe <unknown> | 2002-02-11 02:15:56 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2002-02-11 02:15:56 +0000 |
commit | 059b5ea7391a9879a96921b256a185165e8ab2db (patch) | |
tree | 8fccbc9b0127de0aa755ebbef0a78b4ca1609bad /src/StyleContext.h | |
parent | 537e81b993a0118c5c51018f5697ae4f5c1cc3bc (diff) | |
download | scintilla-mirror-059b5ea7391a9879a96921b256a185165e8ab2db.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.h | 38 |
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_; |