From 89c0ab405ada4e305e51ac5d7c0e4a9885f75e79 Mon Sep 17 00:00:00 2001 From: daboe01 Date: Mon, 4 Apr 2022 10:16:37 +0200 Subject: [PATCH] =?UTF-8?q?Fixed:=20=C3=A5=20and=20=C3=85=20did=20not=20wo?= =?UTF-8?q?rk=20well=20on=20scandinavian=20keyboards=20in=20CPTextView=20(?= =?UTF-8?q?#3031)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AppKit/CPTextView/CPTextView.j | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/AppKit/CPTextView/CPTextView.j b/AppKit/CPTextView/CPTextView.j index 6260b6ab1..07fddaf17 100644 --- a/AppKit/CPTextView/CPTextView.j +++ b/AppKit/CPTextView/CPTextView.j @@ -1053,7 +1053,7 @@ Sets the selection to a range of characters in response to user action. [[_window platformWindow] _propagateCurrentDOMEvent:YES]; // for the _CPNativeInputManager (necessary at least on FF and chrome) - if (![_CPNativeInputManager isNativeInputFieldActive] && [event charactersIgnoringModifiers].charCodeAt(0) != 229) // filter out 229 because this would be inserted in chrome on each deadkey + if (![_CPNativeInputManager isNativeInputFieldActive] && ![_CPNativeInputManager isDeadKey:event]) [self interpretKeyEvents:[event]]; [_caret setPermanentlyVisible:YES]; @@ -2638,7 +2638,14 @@ var _CPCopyPlaceholder = '-'; { return _CPNativeInputFieldActive; } ++ (void)isDeadKey:(CPEvent)event +{ +#if PLATFORM(DOM) + return event._DOMEvent && (event._DOMEvent.key == 'Dead' || event._DOMEvent.key == 'Process'); +#endif + return NO; +} + (void)cancelCurrentNativeInputSession { @@ -2713,14 +2720,6 @@ var _CPCopyPlaceholder = '-'; var charCode = _CPNativeInputField.innerHTML.charCodeAt(0); - // å and Å need to be filtered out in keyDown: due to chrome inserting 229 on a deadkey - if (charCode == 229 || charCode == 197) - { - [currentFirstResponder insertText:_CPNativeInputField.innerHTML]; - _CPNativeInputField.innerHTML = ''; - return; - } - // chrome-trigger: keypressed is omitted for deadkeys if (!_CPNativeInputFieldActive && _CPNativeInputFieldKeyPressedCalled == NO && _CPNativeInputField.innerHTML.length && _CPNativeInputField.innerHTML != _CPCopyPlaceholder && _CPNativeInputField.innerHTML.length < 3) {