(e: React.KeyboardEvent)
| 120 | }, [activeIndex]); |
| 121 | |
| 122 | const handleKeyDown = (e: React.KeyboardEvent) => { |
| 123 | if (e.key === "ArrowDown") { |
| 124 | e.preventDefault(); |
| 125 | setActiveIndex((i) => Math.min(i + 1, flatResults.length - 1)); |
| 126 | } else if (e.key === "ArrowUp") { |
| 127 | e.preventDefault(); |
| 128 | setActiveIndex((i) => Math.max(i - 1, 0)); |
| 129 | } else if (e.key === "Enter") { |
| 130 | e.preventDefault(); |
| 131 | const cmd = flatResults[activeIndex]; |
| 132 | if (cmd) { |
| 133 | closePalette(); |
| 134 | runCommand(cmd.id); |
| 135 | } |
| 136 | } |
| 137 | }; |
| 138 | |
| 139 | const handleSelect = (cmd: Command) => { |
| 140 | closePalette(); |
nothing calls this directly
no test coverage detected