See attached. Seems to work for me (but I didn't look in all the
corners)

OK to commit?

- Martin
Index: toc.C
===================================================================
--- toc.C       (revision 15221)
+++ 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();
@@ -212,6 +211,7 @@
                        pit_type const newpit = std::distance(pars.begin(), q);
                        pit_type const len = std::distance(s, p);
                        pit += len;
+                       recordUndo(cur, Undo::ATOMIC, newpit, pit);
                        pars.insert(q, s, p);
                        s = boost::next(pars.begin(), pit);
                        ParagraphList::iterator t = boost::next(s, len);
@@ -243,6 +243,7 @@
                        }
                        pit_type const newpit = std::distance(pars.begin(), q);
                        pit_type const len = std::distance(s, p);
+                       recordUndo(cur, Undo::ATOMIC, pit, newpit - len);
                        pars.insert(q, s, p);
                        s = boost::next(pars.begin(), pit);
                        ParagraphList::iterator t = boost::next(s, len);
@@ -251,6 +252,7 @@
                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) {

Attachment: pgpx4pqhYxMwH.pgp
Description: PGP signature

Reply via email to