Skip to content
Snippets Groups Projects
Commit d52bec00 authored by Jean Chalard's avatar Jean Chalard
Browse files

[CB23] Merge add and deleteLast

Bug: 13406701
Change-Id: Id9a2e4144b1908ad27d78228ee19e6fc4d4d669f
parent 633e4f45
No related branches found
No related tags found
No related merge requests found
......@@ -165,14 +165,14 @@ public final class WordComposer {
}
/**
* Add a new event for a key stroke, with the pressed key's code point with the touch point
* coordinates.
* Process an input event.
*
* All input events should be supported, including software/hardware events, characters as well
* as deletions, multiple inputs and gestures.
*
* @param event the event to process.
*/
public void add(final Event event) {
processEvent(event);
}
private void processEvent(final Event event) {
public void processEvent(final Event event) {
final int primaryCode = event.mCodePoint;
final int keyX = event.mX;
final int keyY = event.mY;
......@@ -223,13 +223,6 @@ public final class WordComposer {
mAutoCorrection = null;
}
/**
* Delete the last composing unit as a result of hitting backspace.
*/
public void deleteLast(final Event event) {
processEvent(event);
}
public void setCursorPositionWithinWord(final int posWithinWord) {
mCursorPositionWithinWord = posWithinWord;
// TODO: compute where that puts us inside the events
......@@ -301,7 +294,7 @@ public final class WordComposer {
final int codePoint = Character.codePointAt(word, i);
// We don't want to override the batch input points that are held in mInputPointers
// (See {@link #add(int,int,int)}).
add(Event.createEventForCodePointFromUnknownSource(codePoint));
processEvent(Event.createEventForCodePointFromUnknownSource(codePoint));
}
}
......@@ -318,7 +311,7 @@ public final class WordComposer {
reset();
final int length = codePoints.length;
for (int i = 0; i < length; ++i) {
add(Event.createEventForCodePointFromAlreadyTypedText(codePoints[i],
processEvent(Event.createEventForCodePointFromAlreadyTypedText(codePoints[i],
CoordinateUtils.xFromArray(coordinates, i),
CoordinateUtils.yFromArray(coordinates, i)));
}
......
......@@ -727,7 +727,7 @@ public final class InputLogic {
resetComposingState(false /* alsoResetLastComposedWord */);
}
if (isComposingWord) {
mWordComposer.add(inputTransaction.mEvent);
mWordComposer.processEvent(inputTransaction.mEvent);
// If it's the first letter, make note of auto-caps state
if (mWordComposer.isSingleLetter()) {
// We pass 1 to getPreviousWordForSuggestion because we were not composing a word
......@@ -893,7 +893,7 @@ public final class InputLogic {
mWordComposer.reset();
mWordComposer.setRejectedBatchModeSuggestion(rejectedSuggestion);
} else {
mWordComposer.deleteLast(inputTransaction.mEvent);
mWordComposer.processEvent(inputTransaction.mEvent);
}
mConnection.setComposingText(getTextWithUnderline(mWordComposer.getTypedWord()), 1);
inputTransaction.setRequiresUpdateSuggestions();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment