From: Richard Heck Date: Sat, 3 Jan 2015 16:33:11 +0000 (-0500) Subject: Cleanup of outliner moving code. X-Git-Tag: 2.2.0alpha1~1394 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=935646bf9169b4b93a43c572f0cb9d18e8ebfc55;p=features.git Cleanup of outliner moving code. --- diff --git a/src/Text3.cpp b/src/Text3.cpp index 2092ac6ac0..4c99c15774 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -345,8 +345,6 @@ static void outline(OutlineOp mode, Cursor & cur) ParagraphList::iterator finish = start; ParagraphList::iterator const end = pars.end(); - DocumentClass const & tc = buf.params().documentClass(); - int const thistoclevel = buf.text().getTocLevel(distance(bgn, start)); int toclevel; @@ -417,12 +415,17 @@ static void outline(OutlineOp mode, Cursor & cur) toclevel = buf.text().getTocLevel(distance(bgn, start)); if (toclevel == Layout::NOT_IN_TOC) continue; + + DocumentClass const & tc = buf.params().documentClass(); DocumentClass::const_iterator lit = tc.begin(); DocumentClass::const_iterator len = tc.end(); + int const newtoclevel = + (mode == OutlineIn ? toclevel + 1 : toclevel - 1); + LabelType const oldlabeltype = start->layout().labeltype; + for (; lit != len; ++lit) { - if (lit->toclevel == (mode == OutlineIn ? - toclevel + 1 : toclevel - 1) && - start->layout().labeltype == lit->labeltype) { + if (lit->toclevel == newtoclevel && + lit->labeltype == oldlabeltype) { start->setLayout(*lit); break; }