fix: make SPACE key toggle selections in autocomplete multiselect prompts (#1557)
- Override _isActionKey to treat SPACE as an action key instead of search input, and add key handler to toggle selections when not navigating - update IDE selection prompt message from "Select tools:" to "Integrate with:".
This commit is contained in:
parent
8be3713595
commit
7c0e5d5e1d
|
|
@ -322,6 +322,25 @@ async function autocompleteMultiselect(options) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// === FIX: Make SPACE always act as selection key (not search input) ===
|
||||||
|
// Override _isActionKey to treat SPACE like TAB - always an action key
|
||||||
|
// This prevents SPACE from being added to the search input
|
||||||
|
const originalIsActionKey = prompt._isActionKey.bind(prompt);
|
||||||
|
prompt._isActionKey = function (char, key) {
|
||||||
|
if (key && key.name === 'space') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return originalIsActionKey(char, key);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Handle SPACE toggle when NOT navigating (internal code only handles it when isNavigating=true)
|
||||||
|
prompt.on('key', (char, key) => {
|
||||||
|
if (key && key.name === 'space' && !prompt.isNavigating && prompt.focusedValue !== undefined) {
|
||||||
|
prompt.toggleSelected(prompt.focusedValue);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// === END FIX ===
|
||||||
|
|
||||||
const result = await prompt.prompt();
|
const result = await prompt.prompt();
|
||||||
await handleCancel(result);
|
await handleCancel(result);
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
|
|
@ -634,7 +634,7 @@ class UI {
|
||||||
|
|
||||||
// Interactive mode
|
// Interactive mode
|
||||||
const interactiveSelectedIdes = await prompts.autocompleteMultiselect({
|
const interactiveSelectedIdes = await prompts.autocompleteMultiselect({
|
||||||
message: 'Select tools:',
|
message: 'Integrate with:',
|
||||||
options: allToolOptions,
|
options: allToolOptions,
|
||||||
initialValues: configuredIdes.length > 0 ? configuredIdes : undefined,
|
initialValues: configuredIdes.length > 0 ? configuredIdes : undefined,
|
||||||
required: false,
|
required: false,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue