Skip to content

Commit

Permalink
Fix(@inquirer/search) Search list navigation shouldn't listen for vim…
Browse files Browse the repository at this point in the history
…/emacs keybindings
  • Loading branch information
SBoudrias committed Jul 22, 2024
1 parent 6fa9545 commit 10a5eb7
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions packages/search/src/index.mts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import {
useEffect,
useMemo,
isEnterKey,
isUpKey,
isDownKey,
Separator,
makeTheme,
type Theme,
Expand Down Expand Up @@ -128,13 +126,13 @@ export default createPrompt(
if (isEnterKey(key) && selectedChoice) {
setStatus('done');
done(selectedChoice.value);
} else if (status !== 'searching' && (isUpKey(key) || isDownKey(key))) {
} else if (status !== 'searching' && (key.name === 'up' || key.name === 'down')) {
rl.clearLine(0);
if (
(isUpKey(key) && active !== bounds.first) ||
(isDownKey(key) && active !== bounds.last)
(key.name === 'up' && active !== bounds.first) ||
(key.name === 'down' && active !== bounds.last)
) {
const offset = isUpKey(key) ? -1 : 1;
const offset = key.name === 'up' ? -1 : 1;
let next = active;
do {
next = (next + offset + searchResults.length) % searchResults.length;
Expand Down

0 comments on commit 10a5eb7

Please sign in to comment.