]> git.lyx.org Git - features.git/commitdiff
Fixup the fixup 4499680b: use editable()/isActive()
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 23 Jun 2017 18:32:32 +0000 (20:32 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 3 Jul 2017 09:59:24 +0000 (11:59 +0200)
While 1c07c0dc was too strong and broke mathed, 4499680b is too
lenient and can accept insets (mathed/CommandInset, InsetInfo) that
have a positive nargs() but are not editable (because they encapsulate
something).

Therefore the best solution for now is to use editable() in text and
isActive() in mathed, until those two things are merged.

Part of #10667.

(cherry picked from commit 13c3c1485b68980c51658cef8fadf804982d75ee)

src/DocIterator.cpp

index 80e67ee2cf8e6ea649a386484f7a2d2b847546ed..6548186fd79e6399c8e56255c885affe9a30a017 100644 (file)
@@ -535,7 +535,9 @@ bool DocIterator::fixIfBroken()
        size_t n = slices_.size();
        for (; i != n; ++i) {
                CursorSlice & cs = slices_[i];
-               if (&cs.inset() != inset || cs.nargs() == 0) {
+               if (&cs.inset() != inset
+                   || (cs.inset().inMathed() ? ! cs.inset().isActive()
+                                             : ! cs.inset().editable())) {
                        // the whole slice is wrong, chop off this as well
                        --i;
                        LYXERR(Debug::DEBUG, "fixIfBroken(): inset changed");