@inquirer/rawlist
Advanced tools
+6
-5
@@ -63,2 +63,3 @@ import { createPrompt, useMemo, useState, useKeypress, usePrefix, isDownKey, isEnterKey, isUpKey, Separator, makeTheme, ValidationError, } from '@inquirer/core'; | ||
| const theme = makeTheme(rawlistTheme, config.theme); | ||
| const { keybindings } = theme; | ||
| const prefix = usePrefix({ status, theme }); | ||
@@ -88,7 +89,7 @@ const bounds = useMemo(() => { | ||
| } | ||
| else if (isUpKey(key) || isDownKey(key)) { | ||
| else if (isUpKey(key, keybindings) || isDownKey(key, keybindings)) { | ||
| rl.clearLine(0); | ||
| const [selectedChoice, active] = getSelectedChoice(value, choices); | ||
| if (!selectedChoice) { | ||
| const firstChoice = isDownKey(key) | ||
| const firstChoice = isDownKey(key, keybindings) | ||
| ? choices.find(isSelectableChoice) | ||
@@ -99,5 +100,5 @@ : choices.findLast(isSelectableChoice); | ||
| else if (loop || | ||
| (isUpKey(key) && active !== bounds.first) || | ||
| (isDownKey(key) && active !== bounds.last)) { | ||
| const offset = isUpKey(key) ? -1 : 1; | ||
| (isUpKey(key, keybindings) && active !== bounds.first) || | ||
| (isDownKey(key, keybindings) && active !== bounds.last)) { | ||
| const offset = isUpKey(key, keybindings) ? -1 : 1; | ||
| let next = active; | ||
@@ -104,0 +105,0 @@ let nextChoice; |
+4
-4
| { | ||
| "name": "@inquirer/rawlist", | ||
| "version": "5.2.9", | ||
| "version": "5.3.0", | ||
| "description": "Inquirer rawlist prompt", | ||
@@ -70,4 +70,4 @@ "keywords": [ | ||
| "dependencies": { | ||
| "@inquirer/core": "^11.1.10", | ||
| "@inquirer/type": "^4.0.5" | ||
| "@inquirer/core": "^11.2.0", | ||
| "@inquirer/type": "^4.0.6" | ||
| }, | ||
@@ -90,3 +90,3 @@ "devDependencies": { | ||
| "types": "./dist/index.d.ts", | ||
| "gitHead": "113558c67f0d781d774cf3cf4db48fbcd8738b13" | ||
| "gitHead": "5ca6d1101d5d3f8fb066cd5b389bccfdafbbe0c0" | ||
| } |
+7
-0
@@ -104,2 +104,8 @@ # `@inquirer/rawlist` | ||
| ## Keybindings | ||
| Set `INQUIRER_KEYBINDINGS=vim`, `INQUIRER_KEYBINDINGS=emacs`, or `INQUIRER_KEYBINDINGS=vim,emacs` to enable alternative navigation keybindings globally. | ||
| You can override the environment setting per prompt with `theme.keybindings`. | ||
| ## Theming | ||
@@ -123,2 +129,3 @@ | ||
| }; | ||
| keybindings: readonly ('emacs' | 'vim')[]; | ||
| }; | ||
@@ -125,0 +132,0 @@ ``` |
13339
3.14%168
0.6%136
5.43%Updated
Updated