(entry: string)
| 68 | let draftBeforeHistory = ''; |
| 69 | |
| 70 | function push(entry: string): void { |
| 71 | const sid = sessionId(); |
| 72 | historyIndex = -1; |
| 73 | // Draft sessions have no id yet — drop the entry (see file header). |
| 74 | if (!sid) return; |
| 75 | const trimmed = entry.trim(); |
| 76 | if (!trimmed) return; |
| 77 | const list = historyMap.value[sid] ?? []; |
| 78 | // Skip consecutive duplicates so repeated sends don't pad the history. |
| 79 | if (list.at(-1) === trimmed) return; |
| 80 | const next = [...list, trimmed]; |
| 81 | const capped = next.length > MAX_HISTORY ? next.slice(-MAX_HISTORY) : next; |
| 82 | historyMap.value = { ...historyMap.value, [sid]: capped }; |
| 83 | safeSetJson(STORAGE_KEYS.inputHistory, historyMap.value); |
| 84 | } |
| 85 | |
| 86 | function caretAtTextStart(): boolean { |
| 87 | const el = textareaRef.value; |
nothing calls this directly
no test coverage detected