On Wed, 2006-10-25 at 15:12 +0300, Martin Vermeer wrote: > On Wed, 2006-10-25 at 14:06 +0200, Jean-Marc Lasgouttes wrote: > > >>>>> "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes: > > > > Martin> I believe so. Possibly newpit includes [pit=4], I'm not quite > > Martin> sure (does it matter?) > > > > Is it why you need to use min/max? I think you should not need that. I > > would try without pit=4 first, and then add it if it seems necessary > > :) > > > > The crash recipe: make a document with only two Section paragraphs. Do > > a 'down' of the first one. > > > > JMarc > > Yes, I found that too. > > Attached doesn't crash anymore. > > You're probably right about not needing std::min. I'm going to try that > next ;-)
Yes, and works. Attached. If you don't get this to crash, I propose to commit it. > About names, what would you suggest? > > s = start > p = finish > q = dest > > ? > > Better ideas? I will then do this job separately. - Martin
Index: toc.C
===================================================================
--- toc.C (revision 15477)
+++ toc.C (working copy)
@@ -170,7 +170,6 @@
void outline(OutlineOp mode, LCursor & cur)
{
- recordUndo(cur);
Buffer * buf = & cur.buffer();
pit_type & pit = cur.pit();
ParagraphList & pars = buf->text().paragraphs();
@@ -211,9 +210,10 @@
}
pit_type const newpit = std::distance(pars.begin(), q);
pit_type const len = std::distance(s, p);
- pit += len;
+ pit += len - 1;
+ recordUndo(cur, Undo::ATOMIC, newpit, pit);
pars.insert(q, s, p);
- s = boost::next(pars.begin(), pit);
+ s = boost::next(pars.begin(), pit + 1);
ParagraphList::iterator t = boost::next(s, len);
pit = newpit;
pars.erase(s, t);
@@ -241,16 +241,18 @@
break;
}
}
- pit_type const newpit = std::distance(pars.begin(), q);
+ pit_type newpit = std::distance(pars.begin(), q) - 1;
pit_type const len = std::distance(s, p);
+ recordUndo(cur, Undo::ATOMIC, pit, newpit);
pars.insert(q, s, p);
s = boost::next(pars.begin(), pit);
ParagraphList::iterator t = boost::next(s, len);
- pit = newpit - len;
+ pit = newpit - len + 1;
pars.erase(s, t);
break;
}
case In:
+ recordUndo(cur);
for (; lit != lend; ++lit) {
if ((*lit)->toclevel == thistoclevel + 1 &&
s->layout()->labeltype == (*lit)->labeltype) {
@@ -260,6 +262,7 @@
}
break;
case Out:
+ recordUndo(cur);
for (; lit != lend; ++lit) {
if ((*lit)->toclevel == thistoclevel - 1 &&
s->layout()->labeltype == (*lit)->labeltype) {
signature.asc
Description: This is a digitally signed message part
