Файли
openidea/src/platform/ime.ts
T
l0ng-ai f73c0a6b1d fix(keymap): Don't run the Enter that commits an input-method candidate
WebKit sends the Enter (or Space) that commits a candidate after compositionend,
with isComposing already false and keyCode 229. Handlers that checked isComposing
alone ran it: dialogs confirmed and shortcuts fired while typing Chinese or
Japanese. isImeKey() checks both, and every keydown handler that skipped
composition uses it.
2026-10-27 17:16:46 +08:00

9 рядки
380 B
TypeScript

/**
* True while an input method is composing, including the key that ends it: WebKit sends the
* Enter / Space that commits a candidate after `compositionend`, with `isComposing` already
* false and keyCode 229, so a handler checking `isComposing` alone runs that Enter.
*/
export function isImeKey(e: KeyboardEvent): boolean {
return e.isComposing || e.keyCode === 229;
}