Skip to content

fix: treat IME-committed ideographic space as the space key - #608

Merged
43081j merged 2 commits into
bombshell-dev:mainfrom
kai-natori:fix/ime-ideographic-space
Sep 22, 2026
Merged

43081j merged 2 commits into
bombshell-dev:mainfrom
kai-natori:fix/ime-ideographic-space

Conversation

@kai-natori

Copy link
Copy Markdown
Contributor

What does this PR do?

Japanese (and other CJK) IMEs commit an ideographic space (U+3000) instead of U+0020 when the space key is pressed. Node readline reports such keypresses with no key.name, so prompts never see a space key — actions like toggling multiselect options silently do nothing while an IME is active.

This PR normalizes a keypress whose key.name is undefined and whose committed char is U+3000 to name: 'space' in the base Prompt.onKeypress, fixing the behavior for multiselect, group multiselect, autocomplete, and custom prompts. Text input is unaffected — the committed character still lands in the readline buffer as before.

No linked issue — I ran into this directly while using clack-based prompts with Japanese IME input. Happy to file one if preferred.

Type of change

  • Bug fix

Checklist

  • pnpm test passes (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • I have added a changeset

AI-generated code disclosure

  • This PR includes AI-generated code

@changeset-bot

changeset-bot Bot commented Sep 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e65846a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@clack/core Patch
@clack/prompts Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Sep 21, 2026

Copy link
Copy Markdown

commit: e65846a

Comment thread packages/core/src/prompts/prompt.ts Outdated
Japanese, Chinese and other CJK IMEs can commit an ideographic space
(U+3000) instead of U+0020 when the space key is pressed. Node readline
reports it with no key name, so prompts never saw a space key and
toggling multi-select options silently did nothing.

Handle the unnamed ideographic space keypress in MultiSelectPrompt and
GroupMultiSelectPrompt directly, so the raw character stays observable
for consumers that want to detect U+3000 itself.
@kai-natori
kai-natori force-pushed the fix/ime-ideographic-space branch from c83f17a to 97cf678 Compare September 21, 2026 08:40
Comment thread packages/core/test/prompts/group-multiselect.test.ts Outdated
Comment thread packages/core/test/prompts/multi-select.test.ts Outdated
Comment thread packages/core/src/prompts/group-multiselect.ts Outdated
Co-authored-by: James Garbutt <43081j@users.noreply.github.com>
@43081j
43081j merged commit f2bc46b into bombshell-dev:main Sep 22, 2026
9 checks passed
@bombshell-bot bombshell-bot Bot mentioned this pull request Sep 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants