ecere/gui/EditBox: Clearing Undo buffer on setting contents
authorJerome St-Louis <jerome@ecere.com>
Sat, 22 Oct 2016 14:05:59 +0000 (10:05 -0400)
committerJerome St-Louis <jerome@ecere.com>
Sat, 22 Oct 2016 14:05:59 +0000 (10:05 -0400)
- Added Clear() method to UndoBuffer

ecere/src/gui/controls/EditBox.ec

index a811a1b..05816d5 100644 (file)
@@ -298,6 +298,15 @@ public:
       else
          delete action;
    }
+
+   void Clear()
+   {
+      actions.Free();
+      actions.size = 8;
+      count = 0;
+      curAction = 0;
+      firstEvent = true;
+   }
 };
 
 static class AddCharAction : UndoAction
@@ -816,6 +825,8 @@ public:
       {
          if(this)
          {
+            undoBuffer.Clear();
+
             undoBuffer.dontRecord++;
             Deselect();
             DelCh(this.lines.first, 0, 0, this.lines.last, this.lineCount-1, ((EditLine)(this.lines.last)).count, true);