Merge pull request #15234 from calixteman/reset_undo_queue

[Editor] Reset the queue when a command is added after having undone all the commands
This commit is contained in:
calixteman 2022-07-28 09:43:10 +02:00 committed by GitHub
commit e515a88faf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -108,6 +108,11 @@ class CommandManager {
const save = { cmd, undo, type };
if (this.#position === -1) {
if (this.#commands.length > 0) {
// All the commands have been undone and then a new one is added
// hence we clear the queue.
this.#commands.length = 0;
}
this.#position = 0;
this.#commands.push(save);
return;