Port test from @PatrickShaw #432. Allow infinite captureTimeout in UndoManager #431. Closes #432

This commit is contained in:
Kevin Jahns
2022-10-18 16:45:30 +02:00
parent 8fb73edd97
commit 7395229086
2 changed files with 14 additions and 1 deletions

View File

@@ -224,7 +224,7 @@ export class UndoManager extends Observable {
})
const now = time.getUnixTime()
let didAdd = false
if (now - this.lastChange < this.captureTimeout && stack.length > 0 && !undoing && !redoing) {
if (this.lastChange > 0 && now - this.lastChange < this.captureTimeout && stack.length > 0 && !undoing && !redoing) {
// append change to last stack op
const lastOp = stack[stack.length - 1]
lastOp.deletions = mergeDeleteSets([lastOp.deletions, transaction.deleteSet])