mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 10:18:50 +00:00
restore undo on parlist level.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7912 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
b79331e005
commit
0336ebd447
@ -64,23 +64,12 @@ void recordUndo(BufferView * bv, Undo::undo_kind kind,
|
|||||||
for (ParIterator it = buf->par_iterator_begin(); it != null; ++it, ++pcount)
|
for (ParIterator it = buf->par_iterator_begin(); it != null; ++it, ++pcount)
|
||||||
if (&it.plist() == &plist)
|
if (&it.plist() == &plist)
|
||||||
break;
|
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())
|
|
||||||
first = it.outerPar();
|
|
||||||
if (it->id() == last->id())
|
|
||||||
last = it.outerPar();
|
|
||||||
}
|
|
||||||
|
|
||||||
// And calculate a stable reference to them
|
// And calculate a stable reference to them
|
||||||
int const first_offset = firstpar;
|
int const first_offset = firstpar;
|
||||||
int const last_offset = plist.size() - lastpar;
|
int const last_offset = plist.size() - lastpar;
|
||||||
|
|
||||||
// Undo::ATOMIC are always recorded (no overlapping there).
|
// Undo::ATOMIC are always recorded (no overlapping there).
|
||||||
|
|
||||||
// Overlapping only with insert and delete inside one paragraph:
|
// Overlapping only with insert and delete inside one paragraph:
|
||||||
// Nobody wants all removed character appear one by one when undoing.
|
// Nobody wants all removed character appear one by one when undoing.
|
||||||
if (! undo_finished && kind != Undo::ATOMIC) {
|
if (! undo_finished && kind != Undo::ATOMIC) {
|
||||||
@ -124,14 +113,14 @@ void recordUndo(BufferView * bv, Undo::undo_kind kind,
|
|||||||
bool performUndoOrRedo(BufferView * bv, Undo const & undo)
|
bool performUndoOrRedo(BufferView * bv, Undo const & undo)
|
||||||
{
|
{
|
||||||
Buffer * buf = bv->buffer();
|
Buffer * buf = bv->buffer();
|
||||||
ParagraphList & plist = buf->paragraphs();
|
|
||||||
|
|
||||||
ParIterator null = buf->par_iterator_end();
|
ParIterator null = buf->par_iterator_end();
|
||||||
ParIterator plit = buf->par_iterator_begin();
|
ParIterator plit = buf->par_iterator_begin();
|
||||||
int n = undo.plist;
|
int n = undo.plist;
|
||||||
for ( ; n && plit != null; ++plit, --n)
|
for ( ; n && plit != null; ++plit, --n)
|
||||||
;
|
;
|
||||||
//lyxerr << "undo: using plist #" << undo.plist << " " << &plit.plist() << endl;
|
BOOST_ASSERT(plit != null);
|
||||||
|
ParagraphList & plist = plit.plist();
|
||||||
|
|
||||||
// Remove new stuff between first and last
|
// Remove new stuff between first and last
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user