]> git.lyx.org Git - features.git/commitdiff
Minor code simplification.
authorRichard Heck <rgheck@lyx.org>
Fri, 29 Dec 2017 20:53:43 +0000 (15:53 -0500)
committerRichard Heck <rgheck@lyx.org>
Fri, 29 Dec 2017 21:00:58 +0000 (16:00 -0500)
src/Text3.cpp

index e8a401c5517dd189c2583320949c1080fdb482b4..812f280a2914f5969846b1244d5ac1df6058e80e 100644 (file)
@@ -1476,17 +1476,15 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
 
                if (change_layout) {
                        setLayout(cur, layout);
-                       bool do_nest = false;
-                       set<docstring> autonests;
-                       set<docstring> autonested;
-                       if (cur.pit() > 0) {
-                               autonests = pars_[cur.pit() - 1].layout().autonests();
-                               autonested = pars_[cur.pit()].layout().isAutonestedBy();
-                               do_nest = !ignoreautonests;
+                       if (cur.pit() > 0 && !ignoreautonests) {
+                               set<docstring> const & autonests =
+                                               pars_[cur.pit() - 1].layout().autonests();
+                               set<docstring> const & autonested =
+                                               pars_[cur.pit()].layout().isAutonestedBy();
+                               if (autonests.find(layout) != autonests.end()
+                                               || autonested.find(old_layout) != autonested.end())
+                                       lyx::dispatch(FuncRequest(LFUN_DEPTH_INCREMENT));
                        }
-                       if (do_nest && (autonests.find(layout) != autonests.end()
-                                       || autonested.find(old_layout) != autonested.end()))
-                               lyx::dispatch(FuncRequest(LFUN_DEPTH_INCREMENT));
                }
 
                Layout::LaTeXArgMap args = tclass[layout].args();