From 10a5eb7ce7bccf1b399482436c532d8356e12e8d Mon Sep 17 00:00:00 2001 From: Simon Boudrias Date: Mon, 22 Jul 2024 16:28:37 -0400 Subject: [PATCH] Fix(@inquirer/search) Search list navigation shouldn't listen for vim/emacs keybindings --- packages/search/src/index.mts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/search/src/index.mts b/packages/search/src/index.mts index 317eefc35..db39227a9 100644 --- a/packages/search/src/index.mts +++ b/packages/search/src/index.mts @@ -8,8 +8,6 @@ import { useEffect, useMemo, isEnterKey, - isUpKey, - isDownKey, Separator, makeTheme, type Theme, @@ -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;