[Editor] Reset the queue when a command is added after having undone all the commands

This commit is contained in:
Calixte Denizet 2022-07-27 23:23:28 +02:00
parent 085dd0a6c5
commit 3c10c71a91

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;