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

Method handleInput

packages/pi-tui/src/components/select-list.ts:112–137  ·  view source on GitHub ↗
(keyData: string)

Source from the content-addressed store, hash-verified

110 }
111
112 handleInput(keyData: string): void {
113 const kb = getKeybindings();
114 // Up arrow - wrap to bottom when at top
115 if (kb.matches(keyData, "tui.select.up")) {
116 this.selectedIndex = this.selectedIndex === 0 ? this.filteredItems.length - 1 : this.selectedIndex - 1;
117 this.notifySelectionChange();
118 }
119 // Down arrow - wrap to top when at bottom
120 else if (kb.matches(keyData, "tui.select.down")) {
121 this.selectedIndex = this.selectedIndex === this.filteredItems.length - 1 ? 0 : this.selectedIndex + 1;
122 this.notifySelectionChange();
123 }
124 // Enter
125 else if (kb.matches(keyData, "tui.select.confirm")) {
126 const selectedItem = this.filteredItems[this.selectedIndex];
127 if (selectedItem && this.onSelect) {
128 this.onSelect(selectedItem);
129 }
130 }
131 // Escape or Ctrl+C
132 else if (kb.matches(keyData, "tui.select.cancel")) {
133 if (this.onCancel) {
134 this.onCancel();
135 }
136 }
137 }
138
139 private renderItem(
140 item: SelectItem,

Callers

nothing calls this directly

Calls 3

notifySelectionChangeMethod · 0.95
getKeybindingsFunction · 0.90
matchesMethod · 0.80

Tested by

no test coverage detected