You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 15, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 15, 2026. It is now read-only.
First-keystroke console error with bracketMatching when using non‑English IME #1687
I found an issue and prepared a minimal HTML demo to reproduce it.
Environment
windows 11
Chrome 146.0.7680.165
@codemirror/state 6.6.0
@codemirror/view 6.40.0
@codemirror/language 6.12.2
Description
When using a non‑English input method (for example, a Chinese IME) with the bracketMatching extension enabled, a runtime error is logged in the browser console on the very first keystroke in the editor.
The error does not occur when using an English input method.
I noticed that issue #1684 reports a similar problem, so this may be related or a duplicate.
Switch your input method to a non‑English IME (e.g., Chinese).
Focus the editor and type a character (the first keystroke).
Observe the runtime error in the browser console.
index.js:1356 CodeMirror plugin crashed: RangeError: Position 5 is out of range for changeset of length 4
at s.mapPos (index.js:758:19)
at s.map (index.js:3101:33)
at s.map (index.js:3236:45)
at F.fromClass.decorations.update (index.js:1887:53)
at jt.update (index.js:1467:32)
at s.updatePlugins (index.js:8036:29)
at s.update (index.js:7934:22)
at s.dispatchTransactions (index.js:7833:28)
at s.dispatch (index.js:7860:14)
at as (index.js:4295:14)
Question
Is this a known limitation/expected behavior, or is it a bug? I can attach the exact console error message, stack trace, and/or a short screen recording if that would help.
Activity
marijnh commentedon Mar 25, 2026
That was a bug in the way
bracketMatchinghandled cursor position at the end of the document. Attached patch fixes it.Fix bogus bracket highlighting being generated at end of document