mirror of
https://github.com/anomalyco/opencode.git
synced 2026-02-01 22:48:16 +00:00
fix(app): support ctrl-n/p in lists (#10036)
This commit is contained in:
@@ -82,6 +82,15 @@ export function useFilteredList<T>(props: FilteredListProps<T>) {
|
||||
const selectedIndex = flat().findIndex((x) => props.key(x) === list.active())
|
||||
const selected = flat()[selectedIndex]
|
||||
if (selected) props.onSelect?.(selected, selectedIndex)
|
||||
} else if (event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey) {
|
||||
if (event.key === "n" || event.key === "p") {
|
||||
event.preventDefault()
|
||||
const navEvent = new KeyboardEvent("keydown", {
|
||||
key: event.key === "n" ? "ArrowDown" : "ArrowUp",
|
||||
bubbles: true,
|
||||
})
|
||||
list.onKeyDown(navEvent)
|
||||
}
|
||||
} else {
|
||||
// Skip list navigation for text editing shortcuts (e.g., Option+Arrow, Option+Backspace on macOS)
|
||||
if (event.altKey || event.metaKey) return
|
||||
|
||||
Reference in New Issue
Block a user