First of all, thank you for the great work on this project.
We found an issue related to IME input. Under normal circumstances, during IME composition the selection is updated to the leading edge of the composition. However, when a single decoration.mark contains two decoration.replace decorations, IME input causes the composed text to remain selected. In this case, the selection is not updated as expected and instead stays on the range of the IME-composed characters.
Normally, selection updates are dispatched to the frontend, but I’ve observed cases where the dispatch is skipped.
Additionally, I found that under certain conditions (e.g. two consecutive Decoration.marks), IME input may cause duplicated rendering of Range<Decoration>.
Attempting to correct this behavior in inputHandler appears to interfere with the internal composition logic in inputState, leading to incorrect compose state calculations.
Thanks, that helped reproduce it. The root of this is a Safari issue, where it will change its composition selection behavior when a node in front of the composition is changed. Attached patch works around it in this case by being more careful about reusing widget buffer nodes. But in a situation where you’re actually adding or updating a widget in front of the composition, the issue will still occur, and there’s not much the editor it can do about that (if it would try to correct the native DOM selection, that’d abort the composition).
That’s great. During my testing, I noticed that IME input can sometimes prevent keys such as Backspace and Command from triggering keydown events at all, which was pretty confusing. This might also be caused by frequent updates to nodes before the active composition. It looks like I need to be extra careful when updating DOM nodes while composition is in progress.
I found that if there are elements with contenteditable="false" inside a .cm-line, IME input may run into issues. When inline widgets are introduced via Decoration.replace or Decoration.widget, input can behave unexpectedly. Have you considered removing contenteditable="false" from the DOM elements created by widgets? This might help avoid the IME input problems.