Skip to content

Commit 008e234

Browse files
committed
classes.updates: Keep redo, if ignore_history set
If an update isn't pushed onto the undo stack (ignore_history=True), there's no reason to clear the redo list.
1 parent 5796a18 commit 008e234

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/classes/updates.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -306,19 +306,19 @@ def insert(self, key, values):
306306
""" Insert a new UpdateAction into the UpdateManager (this action will then be distributed to all listeners) """
307307

308308
self.last_action = UpdateAction('insert', key, values)
309-
self.redoHistory.clear()
310309
if not self.ignore_history:
310+
self.redoHistory.clear()
311311
self.actionHistory.append(self.last_action)
312312
self.dispatch_action(self.last_action)
313313

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

317317
self.last_action = UpdateAction('update', key, values, partial_update)
318-
if self.last_action.key and self.last_action.key[0] != "history":
319-
# Clear redo history for any update except a "history" update
320-
self.redoHistory.clear()
321318
if not self.ignore_history:
319+
if self.last_action.key and self.last_action.key[0] != "history":
320+
# Clear redo history for any update except a "history" update
321+
self.redoHistory.clear()
322322
self.actionHistory.append(self.last_action)
323323
self.dispatch_action(self.last_action)
324324

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

335335
self.last_action = UpdateAction('delete', key)
336-
self.redoHistory.clear()
337336
if not self.ignore_history:
337+
self.redoHistory.clear()
338338
self.actionHistory.append(self.last_action)
339339
self.dispatch_action(self.last_action)
340340

0 commit comments

Comments
 (0)