From 7892c861f9766f2fc977a779c82a89d6afb76319 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Thu, 18 Mar 2004 16:12:51 +0000 Subject: [PATCH] more 'value' semantics for paragraphs git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8504 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView_pimpl.C | 2 +- src/cursor.C | 2 +- src/lyxfind.C | 2 ++ src/lyxfunc.C | 3 ++- src/paragraph.C | 32 +++++++++++++++----------------- src/undo.C | 6 +++--- 6 files changed, 24 insertions(+), 23 deletions(-) diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index f706a06d6c..58f1d633ad 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -933,7 +933,7 @@ bool BufferView::Pimpl::workAreaDispatch(FuncRequest const & cmd0) 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 << ']' diff --git a/src/cursor.C b/src/cursor.C index 3049ea89d5..3f209657a1 100644 --- a/src/cursor.C +++ b/src/cursor.C @@ -118,7 +118,7 @@ DispatchResult LCursor::dispatch(FuncRequest const & cmd0) 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()); diff --git a/src/lyxfind.C b/src/lyxfind.C index 6613798d87..66b4849de1 100644 --- a/src/lyxfind.C +++ b/src/lyxfind.C @@ -112,6 +112,8 @@ void find(BufferView * bv, FuncRequest const & ev) if (!bv || ev.action != LFUN_WORD_FIND) return; + lyxerr << "find called, cmd: " << ev << std::endl; + // data is of the form // " // " diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 3a4545e67b..2394391649 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -577,8 +577,9 @@ void LyXFunc::dispatch(FuncRequest const & cmd, bool verbose) if (!argument.empty()) { last_search = argument; searched_string = argument; - } else + } else { searched_string = last_search; + } if (searched_string.empty()) break; diff --git a/src/paragraph.C b/src/paragraph.C index 71df78078a..2be105b73b 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -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 const & par) 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); } diff --git a/src/undo.C b/src/undo.C index ab798f3dfe..24c1f39a3d 100644 --- a/src/undo.C +++ b/src/undo.C @@ -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; } -- 2.39.2