--- old/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m 2017-06-02 19:25:40.229570000 +0530 +++ new/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m 2017-06-02 19:25:39.268841000 +0530 @@ -986,6 +986,18 @@ // We also don't want to send the character that triggered the insertText, usually a return. [3337563] fKeyEventsNeeded = NO; } + else { + // Fix for JDK-8180370: + // When a marked text is followed by a special character (or any non-marked text), + // Insert text will be called twice, first for the marked text and then for the special char. + // The insertText call with the marked text will set the fKeyEventsNeeded flag to NO + // However, the fKeyEventsNeeded flag needs to be reset to YES for the subsequent insertText + // call with the non-marked text. + // Otherwise, key down will incorrectly ignore that character + if([useString length] > 0) { + fKeyEventsNeeded = YES; + } + } fPAHNeedsToSelect = NO; }