MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / select

Function select

apps/kimi-web/src/composables/useSlashMenu.ts:55–76  ·  view source on GitHub ↗
(item: SlashCommand)

Source from the content-addressed store, hash-verified

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}

Callers

nothing calls this directly

Calls 3

autosizeFunction · 0.85
clearDraftFunction · 0.85
focusMethod · 0.80

Tested by

no test coverage detected