refactor: migrate to useKeyMatchers hook (#21753)

This commit is contained in:
Tommaso Sciortino
2026-03-09 20:48:09 +00:00
committed by GitHub
parent cc43cfa810
commit f7d284a43a
34 changed files with 162 additions and 54 deletions
@@ -6,8 +6,9 @@
import { useReducer, useRef, useEffect, useCallback } from 'react';
import { useKeypress, type Key } from './useKeypress.js';
import { keyMatchers, Command } from '../keyMatchers.js';
import { Command } from '../keyMatchers.js';
import { debugLogger } from '@google/gemini-cli-core';
import { useKeyMatchers } from './useKeyMatchers.js';
export interface SelectionListItem<T> {
key: string;
@@ -290,6 +291,7 @@ export function useSelectionList<T>({
focusKey,
priority,
}: UseSelectionListOptions<T>): UseSelectionListResult {
const keyMatchers = useKeyMatchers();
const baseItems = toBaseItems(items);
const [state, dispatch] = useReducer(selectionListReducer, {
@@ -460,7 +462,7 @@ export function useSelectionList<T>({
}
return false;
},
[dispatch, itemsLength, showNumbers],
[dispatch, itemsLength, showNumbers, keyMatchers],
);
useKeypress(handleKeypress, {