[meld] undo: Move all sequence reset logic into our clear() helper



commit 23ea9375d95756588e4bdee1bb54126cec85c410
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Feb 11 08:35:34 2018 +1000

    undo: Move all sequence reset logic into our clear() helper
    
    This is possible because of the getattr changes in our undo helpers, and
    is about to be useful for checkpoint state maintenance.

 meld/undo.py | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/meld/undo.py b/meld/undo.py
index a8775ff1..691a7b17 100644
--- a/meld/undo.py
+++ b/meld/undo.py
@@ -85,12 +85,8 @@ class UndoSequence(GObject.GObject):
         buffers for the lifetime of the UndoSequence.
         """
         GObject.GObject.__init__(self)
-        self.actions = []
-        self.next_redo = 0
-        self.checkpoints = {}
-        self.group = None
-        self.busy = False
         self.buffer_refs = [weakref.ref(buf) for buf in buffers]
+        self.clear()
 
     def clear(self):
         """Remove all undo and redo actions from this sequence
@@ -105,6 +101,8 @@ class UndoSequence(GObject.GObject):
         self.actions = []
         self.next_redo = 0
         self.checkpoints = {}
+        self.group = None
+        self.busy = False
 
     def can_undo(self):
         """Return whether an undo is possible."""


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]