aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Document.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/Document.cxx')
-rw-r--r--src/Document.cxx12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/Document.cxx b/src/Document.cxx
index 8238ea758..b50b9691a 100644
--- a/src/Document.cxx
+++ b/src/Document.cxx
@@ -149,7 +149,10 @@ int Document::GetLastChild(int lineParent, int level) {
level = GetLevel(lineParent) & SC_FOLDLEVELNUMBERMASK;
int maxLine = LinesTotal();
int lineMaxSubord = lineParent;
- while ((lineMaxSubord < maxLine-1) && IsSubordinate(level, GetLevel(lineMaxSubord+1))) {
+ while (lineMaxSubord < maxLine-1) {
+ EnsureStyledTo(LineStart(lineMaxSubord+2));
+ if (!IsSubordinate(level, GetLevel(lineMaxSubord+1)))
+ break;
lineMaxSubord++;
}
if (lineMaxSubord > lineParent) {
@@ -696,6 +699,13 @@ void Document::SetStyles(int length, char *styles) {
}
}
+bool Document::EnsureStyledTo(int pos) {
+ // 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);
+ return pos <= GetEndStyled();
+}
+
bool Document::AddWatcher(DocWatcher *watcher, void *userData) {
for (int i = 0; i < lenWatchers; i++) {
if ((watchers[i].watcher == watcher) &&