diff --git a/takhta.html b/takhta.html
index 2e494ec..037453f 100644
--- a/takhta.html
+++ b/takhta.html
@@ -713,6 +713,7 @@
let blackQueen = blackKing === 'd8' ? 'e8' : 'd8';
// Undo all moves
+ let historylength = moveHistory.length;
while (moveHistory.length > 0) {
undoMove();
}
@@ -723,8 +724,8 @@
document.getElementById(blackKing).firstChild.data = '♚';
document.getElementById(blackQueen).firstChild.data = '♛';
- // Redo all the moves we can
- while (moveFuture.length > 0) {
+ // Redo until we can or until the point where we were before, whichever is first
+ while (moveHistory.length < historylength) {
if (!redoMove()) {
break;
}