On Thu, Oct 19, 2006 at 05:38:09PM +0200, Jean-Marc Lasgouttes wrote:
> >>>>> "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes:
> 
> Martin> See attached. Seems to work for me (but I didn't look in all
> Martin> the corners)
> 
> Martin, I think the patch does not work. Here is what I did
> 
> - load intro
> - select Chapter1 
> - press down
> - in main window, do Ctrl-Z
> 
> What I see is a mix of both chapters and the chapter 2 heading seems to
> be gone.
> 
> JMarc

Try the attached (for 1.4.x)

I still see a crash upon undoing "Up" in the last section. Don't
understand it. Could you have a look?

- 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,8 @@
                        pit_type const newpit = std::distance(pars.begin(), q);
                        pit_type const len = std::distance(s, p);
                        pit += len;
+                       recordUndo(cur, Undo::ATOMIC, newpit, 
+                               std::min(pit, cur.lastpit()));
                        pars.insert(q, s, p);
                        s = boost::next(pars.begin(), pit);
                        ParagraphList::iterator t = boost::next(s, len);
@@ -243,6 +244,7 @@
                        }
                        pit_type const newpit = std::distance(pars.begin(), q);
                        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);
@@ -251,6 +253,7 @@
                break;
                }
                case In:
+                       recordUndo(cur);
                        for (; lit != lend; ++lit) {
                                if ((*lit)->toclevel == thistoclevel + 1 &&
                                    s->layout()->labeltype == 
(*lit)->labeltype) {
@@ -260,6 +263,7 @@
                        }
                break;
                case Out:
+                       recordUndo(cur);
                        for (; lit != lend; ++lit) {
                                if ((*lit)->toclevel == thistoclevel - 1 &&
                                    s->layout()->labeltype == 
(*lit)->labeltype) {

Attachment: pgpyikcyrqaAt.pgp
Description: PGP signature

Reply via email to