(text: string)
| 51 | } |
| 52 | |
| 53 | addEntry(text: string): void { |
| 54 | if (!text.trim()) return; |
| 55 | |
| 56 | // Remove duplicate if it exists |
| 57 | this.history = this.history.filter((entry) => entry.text !== text); |
| 58 | |
| 59 | // Add new entry at the beginning |
| 60 | this.history.unshift({ |
| 61 | text, |
| 62 | timestamp: Date.now(), |
| 63 | }); |
| 64 | |
| 65 | // Limit history size |
| 66 | if (this.history.length > MAX_HISTORY_SIZE) { |
| 67 | this.history = this.history.slice(0, MAX_HISTORY_SIZE); |
| 68 | } |
| 69 | |
| 70 | this.saveHistory(); |
| 71 | this.resetNavigation(); |
| 72 | } |
| 73 | |
| 74 | navigateUp(currentInput: string): string | null { |
| 75 | if (this.history.length === 0) return null; |
no test coverage detected