mirror of
https://github.com/google/blockly.git
synced 2026-01-10 18:37:09 +01:00
Honour reductions to MAX_UNDO (#2078)
* Honour reductions to MAX_UNDO If MAX_UNDO is reduced, we now throw away the extra records in the stack, as opposed to just not growing it anymore. * shift != unshift Apparently I need a new brain. * Ensure MAX_UNDO isn’t negative.
This commit is contained in:
@@ -523,8 +523,8 @@ Blockly.Workspace.prototype.fireChangeListener = function(event) {
|
||||
if (event.recordUndo) {
|
||||
this.undoStack_.push(event);
|
||||
this.redoStack_.length = 0;
|
||||
if (this.undoStack_.length > this.MAX_UNDO) {
|
||||
this.undoStack_.unshift();
|
||||
while (this.undoStack_.length > this.MAX_UNDO && this.MAX_UNDO >= 0) {
|
||||
this.undoStack_.shift();
|
||||
}
|
||||
}
|
||||
for (var i = 0, func; func = this.listeners_[i]; i++) {
|
||||
|
||||
Reference in New Issue
Block a user