return bv->theLockingInset()->cursor(bv);
return bv->text->cursor;
}
-
+
/**
* returns a pointer to the very first Paragraph depending of where we are
* so it will return the first paragraph of the buffer or the first paragraph
bv->text->status(bv, LyXText::NEED_MORE_REFRESH);
unFreezeUndo();
}
-
-
+
+
// returns false if no undo possible
bool textHandleUndo(BufferView * bv, Undo & undo)
{
Buffer * b = bv->buffer();
-
+
Paragraph * before =
b->getParFromID(undo.number_of_before_par);
Paragraph * behind =
}
vector<Paragraph *> deletelist;
-
+
Paragraph * deletepar;
-
+
// now add old paragraphs to be deleted
if (before != behind || (!behind && !before)) {
if (before)
deletelist.push_back(deletepar);
tmppar = deletepar;
deletepar = deletepar->next();
-
+
// a memory optimization for edit:
// Only layout information
// is stored in the undo. So restore
// clear any selection and set the selection cursor
// for an evt. new selection.
t->clearSelection();
- t->selection.cursor = t->cursor;
+ t->selection.cursor = t->cursor;
t->updateCounters(bv, t->cursor.row());
bv->fitCursor();
}
// clear any selection and set the selection cursor
// for an evt. new selection.
t->clearSelection();
- t->selection.cursor = t->cursor;
+ t->selection.cursor = t->cursor;
t->updateCounters(bv, t->cursor.row());
}
}
delete (*pit);
}
}
-
+
finishUndo();
bv->text->status(bv, LyXText::NEED_MORE_REFRESH);
return true;
}
-
+
bool createUndo(BufferView * bv, Undo::undo_kind kind,
Paragraph const * first, Paragraph const * behind, shared_ptr<Undo> & u)
{
inset_id = first->inInset()->id();
Buffer * b = bv->buffer();
-
+
// Undo::EDIT and Undo::FINISH are
// always finished. (no overlapping there)
// overlapping only with insert and delete inside one paragraph:
return false;
}
}
-
+
// create a new Undo
Paragraph * undopar;
bool textUndo(BufferView * bv)
{
Buffer * b = bv->buffer();
-
+
if (b->undostack.empty()) {
finishNoUndo(bv);
return false;
}
-
+
shared_ptr<Undo> undo = b->undostack.top();
b->undostack.pop();
finishUndo();
-
+
if (!undo_frozen) {
Paragraph * first = b->getParFromID(undo->number_of_before_par);
if (first && first->next())
b->redostack.push(u);
}
}
-
+
// now we can unlock the inset for saftey because the inset pointer could
// be changed during the undo-function. Anyway if needed we have to lock
// the right inset/position if this is requested.
finishNoUndo(bv);
return false;
}
-
+
shared_ptr<Undo> undo = b->redostack.top();
b->redostack.pop();
finishUndo();
-
+
if (!undo_frozen) {
Paragraph * first = bv->buffer()->getParFromID(undo->number_of_before_par);
if (first && first->next())
bv->buffer()->undostack.push(u);
}
}
-
+
// now we can unlock the inset for saftey because the inset pointer could
// be changed during the undo-function. Anyway if needed we have to lock
// the right inset/position if this is requested.