Home Download Buy Blog Forum Support

Undo groups, nested begin_edit()

Re: Undo groups, nested begin_edit()

Postby adzenith on Fri Sep 09, 2011 11:03 pm

Sometimes I want to glue edits I'm making in an on_modified callback to the edits performed to trigger the on_modified callback (so that everything gets undone in one go), but other that that I'm not sure. Maybe these new functions allow me to glue together two different edits? I should investigate.
adzenith
 
Posts: 1214
Joined: Mon Oct 19, 2009 9:12 pm

Re: Undo groups, nested begin_edit()

Postby adzenith on Fri Sep 23, 2011 2:28 am

Finally got a chance to check this out.
My observations:

mark_undo_groups_for_gluing/glue_marked_undo_groups:
Call the first of these before a set of edits to set a mark. Call the second of these after the set of edits to glue everything between the mark and now. Bam! now they undo in one shot.

maybe_mark_undo_groups_for_gluing:
If you call mark_undo_groups, then it resets the marker to now. If you call maybe_mark, it makes a mark if none exists but doesn't move the mark to now if a mark already exists. So you can just keep calling maybe_mark and then glue_marked at the end and it'll be one group, but if you call mark all the time and then glue at the end, it'll only glue between the latest call to mark and now.

unmark_undo_groups_for_gluing
This deletes the mark; that is, it makes it so that the next glue_marked does nothing.
adzenith
 
Posts: 1214
Joined: Mon Oct 19, 2009 9:12 pm


Return to Technical Support

Who is online

Users browsing this forum: Google [Bot] and 21 guests