Skip to content

Commit

Permalink
classes.updates: Keep redo, if ignore_history set
Browse files Browse the repository at this point in the history
If an update isn't pushed onto the undo stack (ignore_history=True),
there's no reason to clear the redo list.
  • Loading branch information
ferdnyc committed Dec 5, 2019
1 parent 5796a18 commit 008e234
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/classes/updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,19 +306,19 @@ def insert(self, key, values):
""" Insert a new UpdateAction into the UpdateManager (this action will then be distributed to all listeners) """

self.last_action = UpdateAction('insert', key, values)
self.redoHistory.clear()
if not self.ignore_history:
self.redoHistory.clear()
self.actionHistory.append(self.last_action)
self.dispatch_action(self.last_action)

def update(self, key, values, partial_update=False):
""" Update the UpdateManager with an UpdateAction (this action will then be distributed to all listeners) """

self.last_action = UpdateAction('update', key, values, partial_update)
if self.last_action.key and self.last_action.key[0] != "history":
# Clear redo history for any update except a "history" update
self.redoHistory.clear()
if not self.ignore_history:
if self.last_action.key and self.last_action.key[0] != "history":
# Clear redo history for any update except a "history" update
self.redoHistory.clear()
self.actionHistory.append(self.last_action)
self.dispatch_action(self.last_action)

Expand All @@ -333,8 +333,8 @@ def delete(self, key):
""" Delete an item from the UpdateManager with an UpdateAction (this action will then be distributed to all listeners) """

self.last_action = UpdateAction('delete', key)
self.redoHistory.clear()
if not self.ignore_history:
self.redoHistory.clear()
self.actionHistory.append(self.last_action)
self.dispatch_action(self.last_action)

Expand Down

0 comments on commit 008e234

Please sign in to comment.