]> git.lyx.org Git - features.git/commitdiff
DEPM: replace loop by existing method
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 15 Feb 2019 15:02:49 +0000 (16:02 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 18 Feb 2019 14:36:21 +0000 (15:36 +0100)
src/Text2.cpp

index e4c0c2614edcbf79b3d4076becae0f5d0f80b81b..c7824bbc715a22f306959ac81bb5330dca1e1859 100644 (file)
@@ -831,15 +831,10 @@ bool Text::deleteEmptyParagraphMechanism(Cursor & cur,
        if (oldpar.isFreeSpacing())
                return false;
 
-       // Find a common inset and the corresponding depth.
-       size_t depth = 0;
-       for (; depth < cur.depth(); ++depth)
-               if (&old.inset() == &cur[depth].inset())
-                       break;
-
        // Whether a common inset is found and whether the cursor is still in
        // the same paragraph (possibly nested).
-       bool const same_par = depth < cur.depth() && old.idx() == cur[depth].idx()
+       int const depth = cur.find(&old.inset());
+       bool const same_par = depth != -1 && old.idx() == cur[depth].idx()
                && old.pit() == cur[depth].pit();
 
        /*