On 01/21/2010 06:06 PM, Jean-Marc Lasgouttes wrote:
Guenter Milde<mi...@users.berlios.de>  writes:
* sometimes, when editing a test case for a bug report, "undo" will
   undo all changes since the buffer was opened in one step.
There was one instance of an undo group that did not get closed (as
richard guessed). It should be fixed now.

This shows the fragility of this undo groups thing when people move code
around. I have reviewed all current uses, but a breakage can happen
again.

There is a solution to this, but I understand that not everybody may
like this: a class UndoGroupHelper that would be basically:

class UndoGroupHelper {
public:
         UndoGroupHelper(Buffer buf) : buf_(buf) { buf.beginUndoGroup() }
         ~UndoGroupHelper() {
              if (buf_ is still loaded)
                 buf_.endUndoGroup()
         }

private:
         Buffer&  buf_;
}

The use of this would be to just instantiate an UndoGroupHelp variable
that would never need to be referred to, but which would do the cleanup
when going out pf scope (like the Path variable we used to have).

Would anybody object to such a class?

Not objecting but I am wondering if could not somewhat convey this information in the LFUN dispatching. I mean that a flag would tell to the dispatcher if Undo should be begun and ended.

Abdel.

Reply via email to