Description
When typing Chinese inside a single-quoted SQL string, intermediate pinyin text may remain after confirming the Chinese candidate. Existing text can also disappear or be replaced unexpectedly.
Steps to reproduce
Open an editor with SQL syntax highlighting enabled.
Type a single quote '.
Switch to a Chinese Pinyin IME.
Type zcfzb and select 资产负债表.
Repeat if necessary—the issue is intermittent.
Expected behavior
Confirming the candidate replaces the intermediate pinyin with 资产负债表, preserving the surrounding text.
Actual behavior
Intermediate characters remain alongside the Chinese text, for example:
'z'c'f'z'b资产负债表'
Sometimes surrounding text disappears or is replaced.
Additional observations
Reported with @codemirror/view 6.43.0.
Reproduces intermittently on Windows.
Ordinary typing did not reproduce it on macOS, where the IME displayed spaces between letters rather than apostrophes.
Not observed when SQL language support is disabled.
I tried reproducing this (Chrome 153 Windows, Simplified Chinese Pinyin keyboard). I create an editor with just [basicSetup(), sql()] as extensions, and two single quotes as initial content. Then I put the cursor between the quotes and repeatedly type z-c-f-z-b-Space. But I’m getting only the Chinese text—the Latin characters disappear as they are supposed to. Am I doing something different from how you reproduce this?
You need to connect to a database first, like SQLite or some other database, and then open the SQL editor. If you type Chinese in the quotes, the characters will get replaced.
If the issue requires a database to reproduce, it is likely not a CodeMirror problem. If you can set up an editor in codemirror.net/try that reproduces it, do let me know.