Skip to content

Commit

Permalink
Move fix to add function
Browse files Browse the repository at this point in the history
  • Loading branch information
Skalakid committed May 16, 2024
1 parent 4cb3ad7 commit 08d12ae
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/web/InputHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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};
}
Expand All @@ -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;
Expand Down

0 comments on commit 08d12ae

Please sign in to comment.