aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/RichInputConnection.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/latin/RichInputConnection.java')
-rw-r--r--java/src/com/android/inputmethod/latin/RichInputConnection.java25
1 files changed, 13 insertions, 12 deletions
diff --git a/java/src/com/android/inputmethod/latin/RichInputConnection.java b/java/src/com/android/inputmethod/latin/RichInputConnection.java
index 1acca5860..b27db579f 100644
--- a/java/src/com/android/inputmethod/latin/RichInputConnection.java
+++ b/java/src/com/android/inputmethod/latin/RichInputConnection.java
@@ -45,6 +45,7 @@ public final class RichInputConnection {
private static final String TAG = RichInputConnection.class.getSimpleName();
private static final boolean DBG = false;
private static final boolean DEBUG_PREVIOUS_TEXT = false;
+ private static final boolean DEBUG_BATCH_NESTING = false;
// Provision for a long word pair and a separator
private static final int LOOKBACK_CHARACTER_NUM = BinaryDictionary.MAX_WORD_LENGTH * 2 + 1;
private static final Pattern spaceRegex = Pattern.compile("\\s+");
@@ -128,7 +129,7 @@ public final class RichInputConnection {
Log.e(TAG, "Nest level too deep : " + mNestLevel);
}
}
- checkBatchEdit();
+ if (DEBUG_BATCH_NESTING) checkBatchEdit();
if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug();
}
@@ -163,7 +164,7 @@ public final class RichInputConnection {
}
public void finishComposingText() {
- checkBatchEdit();
+ if (DEBUG_BATCH_NESTING) checkBatchEdit();
if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug();
mCommittedTextBeforeComposingText.append(mComposingText);
mCurrentCursorPosition += mComposingText.length();
@@ -177,7 +178,7 @@ public final class RichInputConnection {
}
public void commitText(final CharSequence text, final int i) {
- checkBatchEdit();
+ if (DEBUG_BATCH_NESTING) checkBatchEdit();
if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug();
mCommittedTextBeforeComposingText.append(text);
mCurrentCursorPosition += text.length() - mComposingText.length();
@@ -247,7 +248,7 @@ public final class RichInputConnection {
}
public void deleteSurroundingText(final int i, final int j) {
- checkBatchEdit();
+ if (DEBUG_BATCH_NESTING) checkBatchEdit();
final int remainingChars = mComposingText.length() - i;
if (remainingChars >= 0) {
mComposingText.setLength(remainingChars);
@@ -283,7 +284,7 @@ public final class RichInputConnection {
}
public void sendKeyEvent(final KeyEvent keyEvent) {
- checkBatchEdit();
+ if (DEBUG_BATCH_NESTING) checkBatchEdit();
if (keyEvent.getAction() == KeyEvent.ACTION_DOWN) {
if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug();
// This method is only called for enter or backspace when speaking to old
@@ -331,7 +332,7 @@ public final class RichInputConnection {
}
public void setComposingText(final CharSequence text, final int i) {
- checkBatchEdit();
+ if (DEBUG_BATCH_NESTING) checkBatchEdit();
if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug();
mCurrentCursorPosition += text.length() - mComposingText.length();
mComposingText.setLength(0);
@@ -347,7 +348,7 @@ public final class RichInputConnection {
}
public void setSelection(final int from, final int to) {
- checkBatchEdit();
+ if (DEBUG_BATCH_NESTING) checkBatchEdit();
if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug();
if (null != mIC) {
mIC.setSelection(from, to);
@@ -361,7 +362,7 @@ public final class RichInputConnection {
}
public void commitCorrection(final CorrectionInfo correctionInfo) {
- checkBatchEdit();
+ if (DEBUG_BATCH_NESTING) checkBatchEdit();
if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug();
// This has no effect on the text field and does not change its content. It only makes
// TextView flash the text for a second based on indices contained in the argument.
@@ -375,7 +376,7 @@ public final class RichInputConnection {
}
public void commitCompletion(final CompletionInfo completionInfo) {
- checkBatchEdit();
+ if (DEBUG_BATCH_NESTING) checkBatchEdit();
if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug();
final CharSequence text = completionInfo.getText();
mCommittedTextBeforeComposingText.append(text);
@@ -575,7 +576,7 @@ public final class RichInputConnection {
}
public void removeTrailingSpace() {
- checkBatchEdit();
+ if (DEBUG_BATCH_NESTING) checkBatchEdit();
final CharSequence lastOne = getTextBeforeCursor(1, 0);
if (lastOne != null && lastOne.length() == 1
&& lastOne.charAt(0) == Keyboard.CODE_SPACE) {
@@ -631,7 +632,7 @@ public final class RichInputConnection {
}
public boolean revertDoubleSpace() {
- checkBatchEdit();
+ if (DEBUG_BATCH_NESTING) checkBatchEdit();
// Here we test whether we indeed have a period and a space before us. This should not
// be needed, but it's there just in case something went wrong.
final CharSequence textBeforeCursor = getTextBeforeCursor(2, 0);
@@ -649,7 +650,7 @@ public final class RichInputConnection {
}
public boolean revertSwapPunctuation() {
- checkBatchEdit();
+ if (DEBUG_BATCH_NESTING) checkBatchEdit();
// Here we test whether we indeed have a space and something else before us. This should not
// be needed, but it's there just in case something went wrong.
final CharSequence textBeforeCursor = getTextBeforeCursor(2, 0);