Fix bug in UndoBuffer with TextViewer
authorlaurent
Tue, 14 Jun 2011 17:38:59 +0200
changeset 545 2f60f3d3c9ad
parent 544 ad4dd01c3c35
child 546 f28df922efbe
Fix bug in UndoBuffer with TextViewer
PLCControler.py
--- a/PLCControler.py	Thu Jun 09 17:51:53 2011 +0200
+++ b/PLCControler.py	Tue Jun 14 17:38:59 2011 +0200
@@ -2698,6 +2698,7 @@
             self.Buffering = False
 
     def MarkProjectAsSaved(self):
+        self.EndBuffering()
         if self.ProjectBuffer is not None:
             self.ProjectBuffer.CurrentSaved()
         else:
@@ -2711,9 +2712,8 @@
             return self.ProjectSaved
 
     def LoadPrevious(self):
+        self.EndBuffering()
         if self.ProjectBuffer is not None:
-            if self.Buffering:
-                self.EndBuffering()
             self.Project = cPickle.loads(self.ProjectBuffer.Previous())
     
     def LoadNext(self):
@@ -2722,7 +2722,7 @@
     
     def GetBufferState(self):
         if self.ProjectBuffer is not None:
-            first = self.ProjectBuffer.IsFirst()
-            last = self.ProjectBuffer.IsLast() and not self.Buffering
+            first = self.ProjectBuffer.IsFirst() and not self.Buffering
+            last = self.ProjectBuffer.IsLast()
             return not first, not last
         return False, False