8187364: Unable to enter zero width non-joiner (ZWNJ) symbol in Swing text component
authoralitvinov
Mon, 12 Nov 2018 22:28:08 +0000
changeset 52737 e6753ace7f6d
parent 52552 1a62b3420c27
child 52738 4c436aab570a
8187364: Unable to enter zero width non-joiner (ZWNJ) symbol in Swing text component Reviewed-by: serb, dmarkov
src/java.desktop/share/classes/javax/swing/text/DefaultEditorKit.java
--- a/src/java.desktop/share/classes/javax/swing/text/DefaultEditorKit.java	Mon Nov 12 12:39:03 2018 +0530
+++ b/src/java.desktop/share/classes/javax/swing/text/DefaultEditorKit.java	Mon Nov 12 22:28:08 2018 +0000
@@ -878,11 +878,10 @@
                         isPrintableMask = ((SunToolkit)tk).isPrintableCharacterModifiersMask(mod);
                     }
 
-                    if (isPrintableMask) {
-                        char c = content.charAt(0);
-                        if ((c >= 0x20) && (c != 0x7F)) {
-                            target.replaceSelection(content);
-                        }
+                    char c = content.charAt(0);
+                    if ((isPrintableMask && (c >= 0x20) && (c != 0x7F)) ||
+                        (!isPrintableMask && (c >= 0x200C) && (c <= 0x200D))) {
+                        target.replaceSelection(content);
                     }
                 }
             }