There was a previous report at #3191 but the linked PR does not fix this problem.
I'll begin with a description of how a certain kind of Chinese input methods work (including the Wubi method, which is very popular in China):
The user inputs something, and the IME updates the candidate list accordingly (compositionstart and compositionupdate)
Until now, nothing is committed or inserted into the text area
Then, the user hits another key, which bears dual functions: (1) confirms the last selection (compositionupdate and compositionend), and then (2) the key itself is considered as input for the next input session.
In the following screencast, I typed "qtqtq", and at the final "q", the problem occurs:
From the console log, you can see that the problem is in _compositionPosition.end: when I typed the final "q", the end position was not correctly set: it thinks the end position is 4, while the correct position should be 2. However, at this point, the composition contains the new input "q", therefore "狠狠q" is inserted.
The root cause is in that xterm.js assumed that when a new composition starts, the length of the committed input remains the same, which is not true in this case. Or it could also be a Chromium bug, when it should update composition BEFORE compositionend.
Details
Browser and browser version: Chrome 123.0.6312.107
There was a previous report at #3191 but the linked PR does not fix this problem.
I'll begin with a description of how a certain kind of Chinese input methods work (including the Wubi method, which is very popular in China):
compositionstart
andcompositionupdate
)compositionupdate
andcompositionend
), and then (2) the key itself is considered as input for the next input session.In the following screencast, I typed "qtqtq", and at the final "q", the problem occurs:
https://github.com/xtermjs/xterm.js/assets/23358293/d20db910-65ee-408a-910f-07c036a1b964
From the console log, you can see that the problem is in
_compositionPosition.end
: when I typed the final "q", theend
position was not correctly set: it thinks the end position is 4, while the correct position should be 2. However, at this point, the composition contains the new input "q", therefore "狠狠q" is inserted.The root cause is in that xterm.js assumed that when a new composition starts, the length of the committed input remains the same, which is not true in this case. Or it could also be a Chromium bug, when it should update composition BEFORE compositionend.
Details
This bug is also reproducible in Visual Studio Code.
Steps to reproduce