Skip to content

Commit

Permalink
Allow forcing an undo group to be closed
Browse files Browse the repository at this point in the history
  • Loading branch information
sorbits committed Sep 2, 2014
1 parent 4d6a817 commit e91bf08
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Frameworks/undo/src/undo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ namespace ng
}
}

void undo_manager_t::end_undo_group (ranges_t const& ranges)
void undo_manager_t::end_undo_group (ranges_t const& ranges, bool force)
{
if(--_nesting_count == 0 && _changes)
if((--_nesting_count == 0 || force) && _changes)
{
_records[_index-1].post_selection = ranges;
_records[_index-1].post_revision = _buffer.bump_revision();
_changes = 0;
}
}

Expand Down
2 changes: 1 addition & 1 deletion Frameworks/undo/src/undo.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace ng
bool can_redo () const;

void begin_undo_group (ranges_t const& ranges);
void end_undo_group (ranges_t const& ranges);
void end_undo_group (ranges_t const& ranges, bool force = false);

ranges_t undo ();
ranges_t redo ();
Expand Down

0 comments on commit e91bf08

Please sign in to comment.