From 1f1a1b0dc7fa31ef167bedd8f00c0e83ae56717e Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Fri, 15 Feb 2019 16:02:49 +0100 Subject: [PATCH] DEPM: replace loop by existing method --- src/Text2.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/Text2.cpp b/src/Text2.cpp index e4c0c2614e..c7824bbc71 100644 --- a/src/Text2.cpp +++ b/src/Text2.cpp @@ -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(); /*