Starting an IME composition over a selection deletes it, and cancelling
the composition left it deleted. When the IME ends with an empty text,
restore the content and the UTF-16 selection from before the
composition, keeping styles, the selection direction and redo. The
cancellation is not recorded as an edit.
AI-assisted-by: claude-opus-5-5