aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/event/DeadKeyCombiner.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/event/DeadKeyCombiner.java')
-rw-r--r--java/src/com/android/inputmethod/event/DeadKeyCombiner.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/event/DeadKeyCombiner.java b/java/src/com/android/inputmethod/event/DeadKeyCombiner.java
index bef4d8594..4f3f4d25f 100644
--- a/java/src/com/android/inputmethod/event/DeadKeyCombiner.java
+++ b/java/src/com/android/inputmethod/event/DeadKeyCombiner.java
@@ -23,6 +23,8 @@ import com.android.inputmethod.latin.Constants;
import java.util.ArrayList;
+import javax.annotation.Nonnull;
+
/**
* A combiner that handles dead keys.
*/
@@ -31,12 +33,18 @@ public class DeadKeyCombiner implements Combiner {
final StringBuilder mDeadSequence = new StringBuilder();
@Override
+ @Nonnull
public Event processEvent(final ArrayList<Event> previousEvents, final Event event) {
- if (null == event) return null; // Just in case some combiner is broken
if (TextUtils.isEmpty(mDeadSequence)) {
+ // No dead char is currently being tracked: this is the most common case.
if (event.isDead()) {
+ // The event was a dead key. Start tracking it.
mDeadSequence.appendCodePoint(event.mCodePoint);
+ return Event.createConsumedEvent(event);
}
+ // Regular keystroke when not keeping track of a dead key. Simply said, there are
+ // no dead keys at all in the current input, so this combiner has nothing to do and
+ // simply returns the event as is. The majority of events will go through this path.
return event;
} else {
// TODO: Allow combining for several dead chars rather than only the first one.