Skip to content

Commit 386d55d

Browse files
committed
Make charCategorizer only use the highest-precedence set of word chars
FIX: `EditorState.charCategorizer` now only uses the highest-precedence set of word characters from the language data, to allow overriding these. See https://discuss.codemirror.net/t/dash-separated-kebab-case-selection-too-inclusive/9619
1 parent aa4ca3c commit 386d55d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/state.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,8 @@ export class EditorState {
371371
/// - Space (contains only whitespace)
372372
/// - Other (anything else)
373373
charCategorizer(at: number): (char: string) => CharCategory {
374-
return makeCategorizer(this.languageDataAt<string>("wordChars", at).join(""))
374+
let chars = this.languageDataAt<string>("wordChars", at)
375+
return makeCategorizer(chars.length ? chars[0] : "")
375376
}
376377

377378
/// Find the word at the given position, meaning the range

0 commit comments

Comments
 (0)