This might be the reason for some of the crashs and/or "magic" code
needed in some places to prevent such: Copying/Assigning Paragraphs
did not copy the row cache, so after moving them around they were
in an inconsistent state until the next 'redoParagraph'.

Andre'
? .paragraph.C.swp
? .undo.C.swp
? 1.diff
Index: BufferView_pimpl.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.C,v
retrieving revision 1.522
diff -u -p -r1.522 BufferView_pimpl.C
--- BufferView_pimpl.C  18 Mar 2004 13:28:45 -0000      1.522
+++ BufferView_pimpl.C  18 Mar 2004 16:08:59 -0000
@@ -933,7 +933,7 @@ bool BufferView::Pimpl::workAreaDispatch
 
 bool BufferView::Pimpl::dispatch(FuncRequest const & cmd)
 {
-       //lyxerr << "*** BufferView::Pimpl: request: " << cmd << std::endl;
+       //lyxerr << "BufferView::Pimpl::dispatch  cmd: " << cmd << std::endl;
        // Make sure that the cached BufferView is correct.
        lyxerr[Debug::ACTION] << "BufferView::Pimpl::Dispatch:"
                << " action[" << cmd.action << ']'
Index: cursor.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/cursor.C,v
retrieving revision 1.75
diff -u -p -r1.75 cursor.C
--- cursor.C    18 Mar 2004 16:05:32 -0000      1.75
+++ cursor.C    18 Mar 2004 16:08:59 -0000
@@ -118,7 +118,7 @@ DispatchResult LCursor::dispatch(FuncReq
        LCursor safe = *this;
 
        for ( ; size(); pop()) {
-               lyxerr << "\nLCursor::dispatch: cmd: " << cmd0 << endl << *this << 
endl;
+               //lyxerr << "\nLCursor::dispatch: cmd: " << cmd0 << endl << *this << 
endl;
                BOOST_ASSERT(pos() <= lastpos());
                BOOST_ASSERT(idx() <= lastidx());
                BOOST_ASSERT(par() <= lastpar());
Index: lyxfind.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfind.C,v
retrieving revision 1.77
diff -u -p -r1.77 lyxfind.C
--- lyxfind.C   1 Mar 2004 17:12:02 -0000       1.77
+++ lyxfind.C   18 Mar 2004 16:08:59 -0000
@@ -112,6 +112,8 @@ void find(BufferView * bv, FuncRequest c
        if (!bv || ev.action != LFUN_WORD_FIND)
                return;
 
+       lyxerr << "find called, cmd: " << ev << std::endl;
+
        // data is of the form
        // "<search>
        //  <casesensitive> <matchword> <forward>"
Index: lyxfunc.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfunc.C,v
retrieving revision 1.583
diff -u -p -r1.583 lyxfunc.C
--- lyxfunc.C   18 Mar 2004 16:08:02 -0000      1.583
+++ lyxfunc.C   18 Mar 2004 16:08:59 -0000
@@ -577,8 +577,9 @@ void LyXFunc::dispatch(FuncRequest const
                        if (!argument.empty()) {
                                last_search = argument;
                                searched_string = argument;
-                       } else
+                       } else {
                                searched_string = last_search;
+                       }
 
                        if (searched_string.empty())
                                break;
Index: paragraph.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph.C,v
retrieving revision 1.355
diff -u -p -r1.355 paragraph.C
--- paragraph.C 25 Feb 2004 12:00:48 -0000      1.355
+++ paragraph.C 18 Mar 2004 16:08:59 -0000
@@ -74,16 +74,12 @@ Paragraph::Paragraph()
 
 
 Paragraph::Paragraph(Paragraph const & par)
-       : y(0), height(0), text_(par.text_), begin_of_body_(par.begin_of_body_),
+       :       itemdepth(par.itemdepth), insetlist(par.insetlist),
+               rows(par.rows), y(par.y), height(par.height),
+               width(par.width), layout_(par.layout_),
+               text_(par.text_), begin_of_body_(par.begin_of_body_),
          pimpl_(new Paragraph::Pimpl(*par.pimpl_, this))
 {
-       itemdepth = 0;
-       // this is because of the dummy layout of the paragraphs that
-       // follow footnotes
-       layout_ = par.layout();
-
-       // copy everything behind the break-position to the new paragraph
-       insetlist = par.insetlist;
        InsetList::iterator it = insetlist.begin();
        InsetList::iterator end = insetlist.end();
        for (; it != end; ++it)
@@ -99,22 +95,24 @@ void Paragraph::operator=(Paragraph cons
 
        lyxerr << "Paragraph::operator=()" << endl;
 
-       text_ = par.text_;
-
-       delete pimpl_;
-       pimpl_ = new Pimpl(*par.pimpl_, this);
-
        itemdepth = par.itemdepth;
-       // this is because of the dummy layout of the paragraphs that
-       // follow footnotes
-       layout_ = par.layout();
 
-       // copy everything behind the break-position to the new paragraph
        insetlist = par.insetlist;
        InsetList::iterator it = insetlist.begin();
        InsetList::iterator end = insetlist.end();
        for (; it != end; ++it)
                it->inset = it->inset->clone().release();
+
+       rows = par.rows;
+       y = par.y;
+       height = par.height;
+       width = par.width;
+       layout_ = par.layout();
+       text_ = par.text_;
+       begin_of_body_ = par.begin_of_body_;
+
+       delete pimpl_;
+       pimpl_ = new Pimpl(*par.pimpl_, this);
 }
 
 
Index: undo.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/undo.C,v
retrieving revision 1.46
diff -u -p -r1.46 undo.C
--- undo.C      18 Mar 2004 12:53:36 -0000      1.46
+++ undo.C      18 Mar 2004 16:08:59 -0000
@@ -214,9 +214,9 @@ void recordUndo(Undo::undo_kind kind,
        Buffer * buf = cur.bv().buffer();
        recordUndo(kind, cur, first, last, buf->undostack());
        buf->redostack().clear();
-       //lyxerr << "undostack:\n";
-       //for (size_t i = 0, n = buf->undostack().size(); i != n && i < 6; ++i)
-       //      lyxerr << "  " << i << ": " << buf->undostack()[i] << std::endl;
+       lyxerr << "undostack:\n";
+       for (size_t i = 0, n = buf->undostack().size(); i != n && i < 6; ++i)
+               lyxerr << "  " << i << ": " << buf->undostack()[i] << std::endl;
 }
 
 

Reply via email to