diff options
-rw-r--r-- | src/Document.cxx | 12 | ||||
-rw-r--r-- | src/Document.h | 1 | ||||
-rw-r--r-- | src/Editor.cxx | 1 |
3 files changed, 10 insertions, 4 deletions
diff --git a/src/Document.cxx b/src/Document.cxx index fb28144dd..9f5018c7e 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -1246,10 +1246,7 @@ bool Document::SetStyles(int length, char *styles) { bool Document::EnsureStyledTo(int pos) { if (pos > GetEndStyled()) { - styleClock++; - if (styleClock > 0x100000) { - styleClock = 0; - } + IncrementStyleClock(); // Ask the watchers to style, and stop as soon as one responds. for (int i = 0; pos > GetEndStyled() && i < lenWatchers; i++) { watchers[i].watcher->NotifyStyleNeeded(this, watchers[i].userData, pos); @@ -1258,6 +1255,13 @@ bool Document::EnsureStyledTo(int pos) { return pos <= GetEndStyled(); } +void Document::IncrementStyleClock() { + styleClock++; + if (styleClock > 0x100000) { + styleClock = 0; + } +} + bool Document::AddWatcher(DocWatcher *watcher, void *userData) { for (int i = 0; i < lenWatchers; i++) { if ((watchers[i].watcher == watcher) && diff --git a/src/Document.h b/src/Document.h index dc9e38e21..f5436ab4f 100644 --- a/src/Document.h +++ b/src/Document.h @@ -210,6 +210,7 @@ public: int GetEndStyled() { return endStyled; } bool EnsureStyledTo(int pos); int GetStyleClock() { return styleClock; } + void IncrementStyleClock(); int SetLineState(int line, int state) { return cb.SetLineState(line, state); } int GetLineState(int line) { return cb.GetLineState(line); } diff --git a/src/Editor.cxx b/src/Editor.cxx index c13398b31..f02ce2b6a 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -3452,6 +3452,7 @@ void Editor::NotifyModified(Document*, DocModification mh, void *) { CheckForChangeOutsidePaint(Range(mh.position, mh.position + mh.length)); } if (mh.modificationType & SC_MOD_CHANGESTYLE) { + pdoc->IncrementStyleClock(); if (paintState == notPainting) { if (mh.position < pdoc->LineStart(topLine)) { // Styling performed before this view |