<i18n dev> Proposal: Reverse attribute remains incorrectly with Input Method

Ichiroh Takiguchi takiguc at linux.vnet.ibm.com
Fri Jun 22 12:13:25 UTC 2018


Hello,
IBM would like to contribute a patch to OpenJDK project.

We'd like to propose a fix of Input Method relating problem.
Can we have a sponsor of the patch?

Problem:
When Input Method's preedit text and text selection were mixed, the 
reverse attribute of selection remained unexpectedly.

Recreate steps:
1. On Japanese locale, start Notepad java demo program
2. Type "123456", and move caret between "4" and "5"
3. Turn on Input Method. type "aiu" (Japanese characters) and keep 
preedit (without committing).
    ("123aiu456" should be displayed)
4. Drag (select) "aiu456" by mouse.
       (If you click out side of preedit text, it will be committed.)
5. Move focus to other window, then move the focus back.
    Preedit text was canceled, and the reverse attribute remained on 
"456".
6. Turn off Input Method, move caret before "1".
    The reverse attribute was cleared.
7. Type "0",  the reverse attribute was still remaining.
(With Input Method, the attribute can delete since preedit string has an 
attribute.)

Candidate fix:
----------
--- 
old/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java  
       2018-06-22 21:01:05.367309169 +0900
+++ 
new/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java  
       2018-06-22 21:01:04.745322344 +0900
@@ -5000,6 +5000,7 @@
              caret.setDot(dot);
          } else if (caret instanceof ComposedTextCaret) {
              dot = caret.getDot();
+            select(dot, dot);
              // Restores original caret
              exchangeCaret(caret, originalCaret);
              caret.setDot(dot);
----------

Thanks,
Ichiroh Takiguchi
IBM Japan, Ltd.



More information about the i18n-dev mailing list