mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-26 00:16:51 +00:00
Fix problems with historyBuffer
This commit is contained in:
10
model.js
10
model.js
@@ -63,18 +63,16 @@ function redo() {
|
||||
|
||||
function invalidated() {
|
||||
if (historyIndex === history.length - 1) {
|
||||
historyIndex += 1;
|
||||
history.push(JSON.stringify(table));
|
||||
if (history.length > historyBuffer) {
|
||||
history = history.slice(-historyBuffer);
|
||||
}
|
||||
historyIndex = history.length - 1;
|
||||
} else {
|
||||
historyIndex += 1;
|
||||
history = history.slice(0, historyIndex);
|
||||
history.push(JSON.stringify(table));
|
||||
}
|
||||
if (history.length > historyBuffer) {
|
||||
console.log('remove history');
|
||||
historyIndex -= 1;
|
||||
history.splice(0, 1);
|
||||
}
|
||||
updateView();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user