Insert string when it is committed

`inputMethodTextChanged` is called every time
when a user is modifying a text on input method support.
In the time, code haven't modified yet.

Code is modified when the user pressed enter key to decide the input,
and only the time `committedCount` becomes non zero.
This commit is contained in:
tyfkda
2016-08-05 08:52:38 +09:00
parent fc0122d9d3
commit 69b653b1c5

View File

@@ -184,15 +184,17 @@ public class InputMethodSupport implements InputMethodRequests, InputMethodListe
}
if (text != null) {
char[] insertion = new char[committedCount];
char c = text.first();
for (int i = 0; i < committedCount; i++) {
insertion[i] = c;
c = text.next();
if (committedCount > 0) {
char[] insertion = new char[committedCount];
char c = text.first();
for (int i = 0; i < committedCount; i++) {
insertion[i] = c;
c = text.next();
}
// Insert this as a compound edit
textArea.setSelectedText(new String(insertion), true);
inputHandler.handleInputMethodCommit();
}
// Insert this as a compound edit
textArea.setSelectedText(new String(insertion), true);
inputHandler.handleInputMethodCommit();
CompositionTextPainter compositionPainter = textArea.getPainter().getCompositionTextpainter();
if (Base.DEBUG) {