-
Bug
-
Resolution: Fixed
-
P3
-
1.3.0
-
beta2
-
generic
-
generic
The implementation of java.awt.im.InputMethodRequests.getInsertPositionOffset in the Swing text components returns wrong values. The returned value apparently is increased for composed characters, while the specification says that the method returns the insert position in the *committed* text.
To see the values, modify test/java/awt/im/CityInputMethod/CityInputMethod.java. After
inputMethodContext.dispatchInputMethodEvent(
InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
as.getIterator(),
committedCharacterCount,
caret,
null);
add the statement
System.out.println("committedCharacterCount: "
+ committedCharacterCount + ", getInsertPositionOffset: "
+ inputMethodContext.getInsertPositionOffset());
Build the input method and install it into your Java runtime. Run Stylepad, click into the text field to get an insertion point, select CityInputMethod, start typing some characters. You'll see that the value returned by getInsertPositionOffset increases even though only composed text is added.
To see the values, modify test/java/awt/im/CityInputMethod/CityInputMethod.java. After
inputMethodContext.dispatchInputMethodEvent(
InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
as.getIterator(),
committedCharacterCount,
caret,
null);
add the statement
System.out.println("committedCharacterCount: "
+ committedCharacterCount + ", getInsertPositionOffset: "
+ inputMethodContext.getInsertPositionOffset());
Build the input method and install it into your Java runtime. Run Stylepad, click into the text field to get an insertion point, select CityInputMethod, start typing some characters. You'll see that the value returned by getInsertPositionOffset increases even though only composed text is added.