From 09477384fe06be9fb56976f2e619f76db0ecde1f Mon Sep 17 00:00:00 2001 From: daboe01 Date: Tue, 9 Jun 2015 19:26:41 +0200 Subject: [PATCH] illegal deadkey sequence fix --- AppKit/CPTextView/CPTextView.j | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/AppKit/CPTextView/CPTextView.j b/AppKit/CPTextView/CPTextView.j index 3165f0a5b..baef6f833 100644 --- a/AppKit/CPTextView/CPTextView.j +++ b/AppKit/CPTextView/CPTextView.j @@ -645,7 +645,11 @@ var kDelegateRespondsTo_textShouldBeginEditing // interface to the _CPNativeInputManager - (void)_activateNativeInputElement:(DOMElemet)aNativeField { - [self insertText:aNativeField.innerHTML]; // FIXME: this hack to provide the visual space for the inputmanager should at least bypass the undomanager + var attributes=[[self typingAttributes] copy]; + [attributes setObject:[CPColor colorWithRed:1 green:1 blue:1 alpha:0] forKey:CPForegroundColorAttributeName]; // make it invisible + var placeholderString = [[CPAttributedString alloc] initWithString:aNativeField.innerHTML attributes:attributes]; + [self insertText:placeholderString]; // FIXME: this hack to provide the visual space for the inputmanager should at least bypass the undomanager + var caretRect = [_layoutManager boundingRectForGlyphRange:CPMakeRange(_selectionRange.location - 1, 1) inTextContainer:_textContainer]; caretRect.origin.x += 2; // two pixel offset to the LHS character @@ -714,7 +718,10 @@ var kDelegateRespondsTo_textShouldBeginEditing - (void)keyDown:(CPEvent)event { [[_window platformWindow] _propagateCurrentDOMEvent:YES]; // necessary for the _CPNativeInputManager to work - [self interpretKeyEvents:[event]]; + + if (![_CPNativeInputManager isNativeInputFieldActive] && [event charactersIgnoringModifiers].charCodeAt(0) != 229) // filter out 229 because this would be inserted in chrome on each deadkey + [self interpretKeyEvents:[event]]; + [_caret setPermanentlyVisible:YES]; }