fix(prompts): harden separator support in group-multiselect and multi-select#547
Open
aqeelat wants to merge 2 commits into
Open
fix(prompts): harden separator support in group-multiselect and multi-select#547aqeelat wants to merge 2 commits into
aqeelat wants to merge 2 commits into
Conversation
…ultiselect
Support { type: 'separator', label?: string } entries in option arrays
for select, multiselect, and groupMultiselect prompts. Separators are
rendered as dim text but skipped by the cursor and excluded from values.
Core changes:
- Add isSeparator() utility and SeparatorOption type to cursor.ts
- Update findCursor() to skip separators alongside disabled options
- Update SelectPrompt and MultiSelectPrompt to skip separators
during cursor initialization and navigation, and exclude them
from toggleAll/toggleInvert
- Refactor GroupMultiSelectPrompt cursor navigation into #moveCursor
that skips separators and non-selectable groups
Prompts changes:
- Update Option type to be a union with SeparatorOption
- Add separator rendering in select, multiselect, and groupMultiselect
- Separators render as dim text without selection UI
Resolves bombshell-dev#2, bombshell-dev#8 from clack-fixes.md.
…-select - Guard toggleValue against separators in GroupMultiSelectPrompt and MultiSelectPrompt - Fix initial cursor placement to skip separators via #findNextSelectable - Prevent separators from receiving group metadata during option flattening - Add hasSelectable guard to prevent cursor landing on unselectable items - Widen options type to include SeparatorOption union, removing as any cast - Deduplicate isSeparatorOption by using shared isSeparator from @clack/core - Adjust limitOptions to account for separators in computedMaxItems - Add tests for GroupMultiSelectPrompt separator behavior
|
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #543 (separator option support). Hardens separator handling across group-multiselect and multi-select prompts.
Changes
toggleValueagainst separators inGroupMultiSelectPromptandMultiSelectPrompt#findNextSelectablegroupmetadata during option flatteninghasSelectableguard to prevent cursor landing on unselectable itemsoptionstype toSeparatorOptionunion, removingas anycastisSeparatorOptionby using sharedisSeparatorfrom@clack/corelimitOptionsto account for separators incomputedMaxItemsGroupMultiSelectPromptseparator behavior