mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-27 03:36:39 +00:00
* src/toc.C: allow upwards movement to first paragraph (bug 3131)
fix from Bernhard Roider. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17582 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d44b37a373
commit
abe620d1ee
19
src/toc.C
19
src/toc.C
@ -63,27 +63,24 @@ void outline(OutlineOp mode, LCursor & cur)
|
||||
}
|
||||
ParagraphList::iterator dest = start;
|
||||
// Move out (up) from this header
|
||||
if (dest != bgn)
|
||||
--dest;
|
||||
else
|
||||
if (dest == bgn)
|
||||
break;
|
||||
// Search previous same-level header above
|
||||
for (; dest != bgn; --dest) {
|
||||
do {
|
||||
--dest;
|
||||
toclevel = dest->layout()->toclevel;
|
||||
if (toclevel != LyXLayout::NOT_IN_TOC
|
||||
&& toclevel <= thistoclevel) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while(dest != bgn &&
|
||||
(toclevel == LyXLayout::NOT_IN_TOC
|
||||
|| toclevel > thistoclevel));
|
||||
// Not found; do nothing
|
||||
if (dest == bgn)
|
||||
if (toclevel == LyXLayout::NOT_IN_TOC || toclevel > thistoclevel)
|
||||
break;
|
||||
pit_type const newpit = std::distance(bgn, dest);
|
||||
pit_type const len = std::distance(start, finish);
|
||||
pit_type const deletepit = pit + len;
|
||||
recordUndo(cur, Undo::ATOMIC, newpit, deletepit - 1);
|
||||
pars.insert(dest, start, finish);
|
||||
start = boost::next(bgn, deletepit);
|
||||
start = boost::next(pars.begin(), deletepit);
|
||||
pit = newpit;
|
||||
pars.erase(start, finish);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user