mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 02:14:50 +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
21
src/toc.C
21
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;
|
||||
@ -117,7 +114,7 @@ void outline(OutlineOp mode, LCursor & cur)
|
||||
// One such was found:
|
||||
pit_type newpit = std::distance(bgn, dest);
|
||||
pit_type const len = std::distance(start, finish);
|
||||
recordUndo(cur, Undo::ATOMIC, pit, newpit -1);
|
||||
recordUndo(cur, Undo::ATOMIC, pit, newpit - 1);
|
||||
pars.insert(dest, start, finish);
|
||||
start = boost::next(bgn, pit);
|
||||
pit = newpit - len;
|
||||
|
Loading…
Reference in New Issue
Block a user