]> git.lyx.org Git - lyx.git/blobdiff - src/Paragraph.cpp
Account for changes in insets when checking changes in selection
[lyx.git] / src / Paragraph.cpp
index 22aa744c39cfe2acc85cb4928590dc88206c57f3..27d1230f97d9f7e637f28113478f8e924e626484 100644 (file)
@@ -598,6 +598,24 @@ bool Paragraph::isChanged(pos_type start, pos_type end) const
        return d->changes_.isChanged(start, end);
 }
 
+// FIXME: Ideally the diverse isChanged() methods should account for that!
+bool Paragraph::hasChangedInsets(pos_type start, pos_type end) const
+{
+       LASSERT(start >= 0 && start <= size(), return false);
+       LASSERT(end > start && end <= size() + 1, return false);
+
+       InsetList::const_iterator icit = d->insetlist_.begin();
+       InsetList::const_iterator iend = d->insetlist_.end();
+       for (; icit != iend; ++icit) {
+               if (icit->pos < start)
+                       continue;
+               if (icit->pos >= end)
+                       break;
+               if (icit->inset && icit->inset->isChanged())
+                       return true;
+       }
+       return false;
+}
 
 bool Paragraph::isChanged() const
 {
@@ -654,8 +672,8 @@ void Paragraph::setChange(pos_type pos, Change const & change)
 
        // see comment in setChange(Change const &) above
        if (!change.deleted() && pos < size())
-                       if (Inset * inset = getInset(pos))
-                               inset->setChange(change);
+               if (Inset * inset = getInset(pos))
+                       inset->setChange(change);
 }