Fix an issue where the `ime_key` is sometimes an empty string, and pressing a keystroke replaces the selected text. E.g. select some text, press `Escape`: selected text is deleted.
Fix an issue where the `ime_key` is sometimes an empty string, and pressing a keystroke replaces the selected text. E.g. select some text, press `Escape`: selected text is deleted.