зеркало из https://github.com/mozilla/pjs.git
Bug 751513 - End composition in onTextChanged() only if we are currently committing. r=blassey
This commit is contained in:
Родитель
0c82f4152d
Коммит
d67c212fbe
|
@ -143,6 +143,9 @@ public class GeckoInputConnection
|
|||
|
||||
@Override
|
||||
public boolean commitText(CharSequence text, int newCursorPosition) {
|
||||
if (mCommittingText)
|
||||
Log.e(LOGTAG, "Please report this bug:", new IllegalStateException("commitText, but already committing text?!"));
|
||||
|
||||
mCommittingText = true;
|
||||
replaceText(text, newCursorPosition, false);
|
||||
mCommittingText = false;
|
||||
|
@ -156,6 +159,7 @@ public class GeckoInputConnection
|
|||
|
||||
@Override
|
||||
public boolean finishComposingText() {
|
||||
// finishComposingText() is sometimes called even when we are not composing text.
|
||||
if (hasCompositionString()) {
|
||||
if (DEBUG) Log.d(LOGTAG, ". . . finishComposingText: endComposition");
|
||||
endComposition();
|
||||
|
@ -289,6 +293,7 @@ public class GeckoInputConnection
|
|||
|
||||
@Override
|
||||
public boolean setComposingText(CharSequence text, int newCursorPosition) {
|
||||
// setComposingText will likely be called multiple times while we are composing text.
|
||||
clampSelection();
|
||||
return super.setComposingText(text, newCursorPosition);
|
||||
}
|
||||
|
@ -592,8 +597,8 @@ public class GeckoInputConnection
|
|||
}
|
||||
}
|
||||
|
||||
boolean needCompositionString = !hasCompositionString();
|
||||
if (needCompositionString) {
|
||||
boolean startCompositionString = !hasCompositionString();
|
||||
if (startCompositionString) {
|
||||
if (DEBUG) Log.d(LOGTAG, ". . . onTextChanged: IME_COMPOSITION_BEGIN");
|
||||
GeckoAppShell.sendEventToGecko(
|
||||
GeckoEvent.createIMEEvent(GeckoEvent.IME_COMPOSITION_BEGIN, 0, 0));
|
||||
|
@ -620,7 +625,7 @@ public class GeckoInputConnection
|
|||
|
||||
// End composition if all characters in the word have been deleted.
|
||||
// This fixes autocomplete results not appearing.
|
||||
if (count == 0 || needCompositionString)
|
||||
if (count == 0 || (startCompositionString && mCommittingText))
|
||||
endComposition();
|
||||
|
||||
// Block this thread until all pending events are processed
|
||||
|
@ -663,8 +668,13 @@ public class GeckoInputConnection
|
|||
|
||||
private void endComposition() {
|
||||
if (DEBUG) Log.d(LOGTAG, "IME: endComposition: IME_COMPOSITION_END");
|
||||
|
||||
if (!hasCompositionString())
|
||||
Log.e(LOGTAG, "Please report this bug:", new IllegalStateException("endComposition, but not composing text?!"));
|
||||
|
||||
GeckoAppShell.sendEventToGecko(
|
||||
GeckoEvent.createIMEEvent(GeckoEvent.IME_COMPOSITION_END, 0, 0));
|
||||
|
||||
mCompositionStart = NO_COMPOSITION_STRING;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче