>>>>> "Michael" == Michael Gerz <[EMAIL PROTECTED]> writes:

Michael> 1. Select the complete document; accept the complete
Michael> selection (i.e. document) in one step Pros: simple to
Michael> implement Cons: may be slow; may be memory-consuming (depends
Michael> on how undo is implemented); the cursor is set to the
Michael> beginning of the document

This is indeed memory consuming, I do not think it is slow. You should
probably try it out.

Michael> 2. Optimize 1: Find the first and last paragraph that
Michael> contains a change; select this part of the document; accept
Michael> the selection

This could be tried if version 1 is not acceptable.

Michael> Undo/redo gurus: Is there a better approach? Is there some
Michael> kind of undo grouping concept that can be used in this case?

Well I have thoughts about an undo blocking mechanism that would work
like

//the real undo we want to apply
recordUndo(something);
lockUndo();
//call here methods that have there own undo calls
...
unlockUndo();


In undo.C we would have

void lockUndo()
{
        BOOST_ASSERT(!locked_undo_);
        locked_undo_ = true;
}

void unlockUndo()
{
        BOOST_ASSERT(locked_undo_);
        locked_undo_ = false;
}

and in doRecordUndo

    if (locked_undo_)
        break;


This would be useful in cases where undo is called too many times for
our taste. However, it would not help in your particular case.

JMarc

Reply via email to