diff --git a/src/main/java/dev/kske/undoredo/ChangeManager.java b/src/main/java/dev/kske/undoredo/ChangeManager.java index 6d520c2..4d45bd5 100644 --- a/src/main/java/dev/kske/undoredo/ChangeManager.java +++ b/src/main/java/dev/kske/undoredo/ChangeManager.java @@ -15,8 +15,8 @@ public final class ChangeManager { private final List changes = new LinkedList<>(); - private int index; - private int markedIndex; + private int index = -1; + private int markedIndex = -1; /** * Applies the given change and appends it to the change list. @@ -27,6 +27,7 @@ public final class ChangeManager { public void addChange(C change) { change.apply(); changes.add(change); + ++index; } /** @@ -81,7 +82,7 @@ public final class ChangeManager { * @since 0.0.1 */ public boolean isUndoAvailable() { - return index > 0; + return index > -1; } /**