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
21
src/toc.C
21
src/toc.C
@ -63,27 +63,24 @@ void outline(OutlineOp mode, LCursor & cur)
|
|||||||
}
|
}
|
||||||
ParagraphList::iterator dest = start;
|
ParagraphList::iterator dest = start;
|
||||||
// Move out (up) from this header
|
// Move out (up) from this header
|
||||||
if (dest != bgn)
|
if (dest == bgn)
|
||||||
--dest;
|
|
||||||
else
|
|
||||||
break;
|
break;
|
||||||
// Search previous same-level header above
|
// Search previous same-level header above
|
||||||
for (; dest != bgn; --dest) {
|
do {
|
||||||
|
--dest;
|
||||||
toclevel = dest->layout()->toclevel;
|
toclevel = dest->layout()->toclevel;
|
||||||
if (toclevel != LyXLayout::NOT_IN_TOC
|
} while(dest != bgn &&
|
||||||
&& toclevel <= thistoclevel) {
|
(toclevel == LyXLayout::NOT_IN_TOC
|
||||||
break;
|
|| toclevel > thistoclevel));
|
||||||
}
|
|
||||||
}
|
|
||||||
// Not found; do nothing
|
// Not found; do nothing
|
||||||
if (dest == bgn)
|
if (toclevel == LyXLayout::NOT_IN_TOC || toclevel > thistoclevel)
|
||||||
break;
|
break;
|
||||||
pit_type const newpit = std::distance(bgn, dest);
|
pit_type const newpit = std::distance(bgn, dest);
|
||||||
pit_type const len = std::distance(start, finish);
|
pit_type const len = std::distance(start, finish);
|
||||||
pit_type const deletepit = pit + len;
|
pit_type const deletepit = pit + len;
|
||||||
recordUndo(cur, Undo::ATOMIC, newpit, deletepit - 1);
|
recordUndo(cur, Undo::ATOMIC, newpit, deletepit - 1);
|
||||||
pars.insert(dest, start, finish);
|
pars.insert(dest, start, finish);
|
||||||
start = boost::next(bgn, deletepit);
|
start = boost::next(pars.begin(), deletepit);
|
||||||
pit = newpit;
|
pit = newpit;
|
||||||
pars.erase(start, finish);
|
pars.erase(start, finish);
|
||||||
break;
|
break;
|
||||||
@ -117,7 +114,7 @@ void outline(OutlineOp mode, LCursor & cur)
|
|||||||
// One such was found:
|
// One such was found:
|
||||||
pit_type newpit = std::distance(bgn, dest);
|
pit_type newpit = std::distance(bgn, dest);
|
||||||
pit_type const len = std::distance(start, finish);
|
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);
|
pars.insert(dest, start, finish);
|
||||||
start = boost::next(bgn, pit);
|
start = boost::next(bgn, pit);
|
||||||
pit = newpit - len;
|
pit = newpit - len;
|
||||||
|
Loading…
Reference in New Issue
Block a user