};
///
Undo(undo_kind kind, int inset_id,
+ int plist,
int first, int last,
int cursor, int cursor_pos,
ParagraphList const & par_arg);
/// Which kind of operation are we recording for?
undo_kind kind;
+ /// to what paragraph list do we belong?
+ int plist;
+
/**
* ID of hosting inset if the cursor is in one.
* if -1, then the cursor is not in an inset.
LyXText * text = inset ? inset->getLyXText(bv) : bv->text;
int const inset_id = inset ? inset->id() : -1;
- // We simply record the entire outer paragraphs
+ // Try to find the appropriate list by counting the,
ParIterator null = buf->par_iterator_end();
+ int pcount = 0;
+ for (ParIterator it = buf->par_iterator_begin(); it != null; ++it, ++pcount)
+ if (&it.plist() == &plist)
+ break;
+ //lyxerr << "This is plist #" << pcount << ' ' << &plist << endl;
+
+ // We simply record the entire outer paragraphs
// First, identify the outer paragraphs
for (ParIterator it = buf->par_iterator_begin(); it != null; ++it) {
if (it->id() == first->id())
// Make and push the Undo entry
stack.push(Undo(kind, inset_id,
+ pcount,
first_offset, last_offset,
cursor_offset, text->cursor.pos(),
ParagraphList()));
- lyxerr << "G" << endl;
// Record the relevant paragraphs
ParagraphList & undo_pars = stack.top().pars;
Buffer * buf = bv->buffer();
ParagraphList & plist = buf->paragraphs();
+ ParIterator null = buf->par_iterator_end();
+ ParIterator plit = buf->par_iterator_begin();
+ int n = undo.plist;
+ for ( ; n && plit != null; ++plit, --n)
+ ;
+ //lyxerr << "undo: using plist #" << undo.plist << " " << &plit.plist() << endl;
+
// Remove new stuff between first and last
{
ParagraphList::iterator first = plist.begin();
LyXText * text = inset ? inset->getLyXText(bv) : bv->text;
text->setCursorIntern(undo.cursor_par_offset, undo.cursor_pos);
- lyxerr << "undo, inset: " << inset << endl;
+ //lyxerr << "undo, inset: " << inset << endl;
if (inset) {
- lyxerr << "undo, inset owner: " << inset->owner() << endl;
+ //lyxerr << "undo, inset owner: " << inset->owner() << endl;
// Magic needed to update inset internal state
FuncRequest cmd(bv, LFUN_INSET_EDIT, "left");