fix initialization of insetOwner after undo (bug 1952).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10619 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2005-11-24 16:22:39 +00:00
parent 73f01338a2
commit f200823716
4 changed files with 25 additions and 3 deletions

View File

@ -1,3 +1,10 @@
2005-11-17 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* dociterator.[Ch]: new member realInset() that returns the cell
for tabulars and the inset for the rest (bug 1952).
* undo.C (textUndoOrRedo): use realInset when resetting insetOwner
(bug 1952).
2005-11-15 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* text.C (leftMargin): honor the NextNoIndent tag in layouts.

View File

@ -20,6 +20,7 @@
#include "mathed/math_data.h"
#include "mathed/math_inset.h"
#include "insets/insettabular.h"
#include <boost/assert.hpp>
#include <boost/current_function.hpp>
@ -90,6 +91,18 @@ InsetBase const * DocIterator::prevInset() const
}
InsetBase * DocIterator::realInset() const
{
BOOST_ASSERT(inTexted());
// if we are in a tabular, we need the cell
if (inset().lyxCode() == InsetBase::TABULAR_CODE) {
InsetTabular & tabular = static_cast<InsetTabular&>(inset());
return tabular.cell(idx()).get();
}
return &inset();
}
MathAtom const & DocIterator::prevAtom() const
{
BOOST_ASSERT(!empty());

View File

@ -164,6 +164,8 @@ public:
LyXText * text();
///
LyXText const * text() const;
/// the containing inset or the cell, respectively
InsetBase * realInset() const;
///
InsetBase * innerInsetOfType(int code) const;
///

View File

@ -187,10 +187,10 @@ bool textUndoOrRedo(BufferView & bv,
// this ugly stuff is needed until we get rid of the
// inset_owner backpointer
ParagraphList::const_iterator pit = undo.pars.begin();
ParagraphList::const_iterator end = undo.pars.end();
ParagraphList::iterator pit = undo.pars.begin();
ParagraphList::iterator const end = undo.pars.end();
for (; pit != end; ++pit)
const_cast<Paragraph &>(*pit).setInsetOwner(&dit.inset());
pit->setInsetOwner(dit.realInset());
plist.insert(first, undo.pars.begin(), undo.pars.end());
}