From 08d12ae6d641d729d26aaefa35db967314a4697f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ska=C5=82ka?= Date: Thu, 16 May 2024 12:09:27 +0200 Subject: [PATCH] Move fix to add function --- src/web/InputHistory.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/web/InputHistory.ts b/src/web/InputHistory.ts index 5299e2d7..f2abc559 100644 --- a/src/web/InputHistory.ts +++ b/src/web/InputHistory.ts @@ -49,9 +49,6 @@ export default class InputHistory { if (this.currentText === null) { this.timeout = null; this.add(text, cursorPosition); - if (this.historyIndex === 0) { - return; - } } else { this.items[this.historyIndex] = {text, cursorPosition}; } @@ -71,7 +68,7 @@ export default class InputHistory { } add(text: string, cursorPosition: number): void { - if (this.items.length > 0) { + if (this.historyIndex > 0 && this.items.length > 0) { const currentItem = this.items[this.historyIndex]; if (currentItem && text === currentItem.text) { return;