diff options
Diffstat (limited to 'src/Accessor.cxx')
-rw-r--r-- | src/Accessor.cxx | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/Accessor.cxx b/src/Accessor.cxx index 57b7e4dc4..60c5968c5 100644 --- a/src/Accessor.cxx +++ b/src/Accessor.cxx @@ -63,35 +63,31 @@ void StylingContext::StartAt(unsigned int start, char chMask) { Platform::SendScintilla(id, SCI_STARTSTYLING, start, chMask); } -void StylingContext::ColourSegment(unsigned int start, unsigned int end, int chAttr) { +void StylingContext::StartSegment(unsigned int pos) { + startSeg = pos; +} + +void StylingContext::ColourTo(unsigned int pos, int chAttr) { // Only perform styling if non empty range - if (end != start - 1) { - if (end < start) { - Platform::DebugPrintf("Bad colour positions %d - %d\n", start, end); + if (pos != startSeg - 1) { + if (pos < startSeg) { + Platform::DebugPrintf("Bad colour positions %d - %d\n", startSeg, pos); } - if (validLen + (end - start + 1) >= bufferSize) + if (validLen + (pos - startSeg + 1) >= bufferSize) Flush(); - if (validLen + (end - start + 1) >= bufferSize) { + if (validLen + (pos - startSeg + 1) >= bufferSize) { // Too big for buffer so send directly - Platform::SendScintilla(id, SCI_SETSTYLING, end - start + 1, chAttr); + Platform::SendScintilla(id, SCI_SETSTYLING, pos - startSeg + 1, chAttr); } else { if (chAttr != chWhile) chFlags = 0; chAttr |= chFlags; - for (unsigned int i = start; i <= end; i++) { + for (unsigned int i = startSeg; i <= pos; i++) { styleBuf[validLen++] = chAttr; } } } -} - -void StylingContext::StartSegment(unsigned int pos) { - startSeg = pos; -} - -void StylingContext::ColourTo(unsigned int pos, int chAttr) { - ColourSegment(startSeg, pos, chAttr); startSeg = pos+1; } |