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

Function onKeypress

apps/kimi-code/src/cli/update/prompt.ts:158–177  ·  view source on GitHub ↗
(_input: string, key: { name?: string; ctrl?: boolean })

Source from the content-addressed store, hash-verified

156 };
157
158 const onKeypress = (_input: string, key: { name?: string; ctrl?: boolean }): void => {
159 if (key.name === 'up') {
160 selectedIndex = moveInstallPromptSelection(selectedIndex, 'up', choices.length);
161 render();
162 return;
163 }
164 if (key.name === 'down') {
165 selectedIndex = moveInstallPromptSelection(selectedIndex, 'down', choices.length);
166 render();
167 return;
168 }
169 if (key.name === 'return' || key.name === 'enter') {
170 const chosen = choices[selectedIndex]?.value ?? 'skip';
171 finish(chosen);
172 return;
173 }
174 if (key.name === 'escape' || (key.ctrl === true && key.name === 'c')) {
175 finish('skip');
176 }
177 };
178
179 emitKeypressEvents(input);
180 if (canSetRawMode) {

Callers

nothing calls this directly

Calls 3

renderFunction · 0.70
finishFunction · 0.70

Tested by

no test coverage detected