Ctrl+W and word navigation broken for digits, punctuation, and non-Latin scripts
Description
Ctrl+W and other word-based navigation (Alt+Left/Right, Alt+Backspace) only recognize Latin letters as word characters. Digits, punctuation, and non-Latin scripts (Cyrillic, CJK, Arabic, Korean) are treated as non-word filler, causing word deletion to eat through them and into the preceding Latin-letter word.
Steps to Reproduce
- Type
abc def hij 123 456 789in the Claude Code input prompt - Press Ctrl+W
- Expected:
789is deleted, leavingabc def hij 123 456 - Actual: Everything from
hijonward is deleted, leavingabc def
Root Cause
Claude Code's word boundary logic uses Intl.Segmenter with granularity: "word" and relies on the isWordLike property to identify words. The code itself is correct.
The problem is in Bun (Claude Code's embedded runtime). Node.js correctly returns isWordLike: true for digit segments:
{"segment":"abc","index":0,"isWordLike":true}
{"segment":" ","index":3,"isWordLike":false}
{"segment":"123","index":4,"isWordLike":true}
Bun apparently returns isWordLike: false for non-letter segments. Since prevWord() skips all non-word-like segments, Ctrl+W and other word-based navigation treat them as part of the preceding Latin-letter word and delete everything back to its start.
Suggested Fix
Something like /\w/.test(H.segment) instead of isWordLike would fix this regardless of the runtime's Intl.Segmenter implementation.
Prior Issues
This has been reported multiple times and closed each time without a fix:
- #1943 - Word deletion doesn't work with non-latin alphabet
- #2239 - Ctrl+W ignores non-Latin words
- #2742 - Option+Delete incorrectly deletes multiple words in Korean input
- #3015 - Ctrl+Backspace and Ctrl+Arrow issues with Cyrillic text
- #10547 - Ctrl+Backspace deletes whole text with Japanese, Arabic, and Korean
- #11997 - Alt-arrow word navigation broken with Cyrillic and non-Latin characters
- #34505 - Ctrl+W deletes across space boundaries, eating multiple words
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗