Skip to content

Commit

Permalink
redo logic fix (it always started redoing 2 steps ahead instead of 1)
Browse files Browse the repository at this point in the history
  • Loading branch information
klesun authored and klesun committed Jan 10, 2016
1 parent ab500e5 commit 46a4116
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/org/klesun_model/SnapshotStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ public Explain<JSONObject> undo()

public Explain<JSONObject> redo()
{
if (redoSnapshots.size() >= 2) {
if (!redoSnapshots.isEmpty()) {
JSONObject current = redoSnapshots.pollLast();
snapshots.add(current);

return new Explain<>(redoSnapshots.peekLast());
return new Explain<>(current);
} else {
return new Explain<>(false, "Here History Ends");
}
Expand Down
1 change: 0 additions & 1 deletion src/org/shmidusic/sheet_music/SheetMusicComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public LinkedHashMap<Combo, ContextAction> getMyClassActionMap() {

.p(new Combo(ctrl, k.VK_E), mkFailableAction(FileProcessor::savePNG).setCaption("Export png"))

/** @debug */
.p(new Combo(ctrl, k.VK_Z), mkFailableAction(sm -> mainPanel.undo()).setCaption("Undo"))
.p(new Combo(ctrl, k.VK_Y), mkFailableAction(sm -> mainPanel.redo()).setCaption("Redo"))
;
Expand Down

0 comments on commit 46a4116

Please sign in to comment.