(item: SlashCommand)
| 53 | } |
| 54 | |
| 55 | function select(item: SlashCommand): void { |
| 56 | open.value = false; |
| 57 | if (item.acceptsInput) { |
| 58 | text.value = `${item.name} `; |
| 59 | void nextTick(() => { |
| 60 | const el = textareaRef.value; |
| 61 | if (!el) return; |
| 62 | const pos = text.value.length; |
| 63 | el.setSelectionRange(pos, pos); |
| 64 | el.focus(); |
| 65 | autosize(); |
| 66 | }); |
| 67 | return; |
| 68 | } |
| 69 | text.value = ''; |
| 70 | clearDraft?.(); |
| 71 | // Menu-selected bare commands (e.g. /model, /login) reach here directly and |
| 72 | // never go through handleSubmit, so record them for recall too. acceptsInput |
| 73 | // commands are pushed later by handleSubmit together with their argument. |
| 74 | historyPush(item.name); |
| 75 | emitCommand(item.name); |
| 76 | } |
| 77 | |
| 78 | return { open, items, active, update, select }; |
| 79 | } |
nothing calls this directly
no test coverage detected