Permalink
Browse files

Initial commit for deletion press

  • Loading branch information...
malayaleecoder committed Aug 22, 2016
1 parent 378767b commit 8d4fc5125390ff521366aabb0ea8771beede4b28
Showing with 10 additions and 5 deletions.
  1. +10 −5 java/src/org.smc.inputmethod/indic/WordComposer.java
@@ -245,24 +245,24 @@ public void applyTransliteration(final Event event) {
String finalword = "";
String previousreplacement = "";
int startPosition;
public void applyTransliterationByEngine(final Event event) {
public void applyTransliterationByEngine (final Event event) {
context = "";
final int primaryCode = event.mCodePoint;
refreshTypedWordCache();
String mTypedWord = mTypedWordCache.toString();
if(mTransliterationEngine != null && Constants.CODE_DELETE != event.mKeyCode) {
if (mTransliterationEngine != null && Constants.CODE_DELETE != event.mKeyCode) {
String current = new String(Character.toChars(primaryCode));
if(previousreplacement == "") {
if (previousreplacement == "") {
startPosition = mTypedWord.length() - 1 > mTransliterationEngine.getMaxKeyLength() ? mTypedWord.length() - mTransliterationEngine.getMaxKeyLength() - 1 : 0;
}
else {
int startPosition = previousreplacement.length() - 1 > mTransliterationEngine.getMaxKeyLength() ? previousreplacement.length() - mTransliterationEngine.getMaxKeyLength() - 1: 0;
}
//String input = mTypedWord.subSequence(startPos, mTypedWord.length()).toString();
String dummyintermediate = mTypedWord.subSequence(mTypedWord.length() - 1, mTypedWord.length()).toString();
if(mTypedWord.length() == 1 && finalword.length() != 0) {
if (mTypedWord.length() == 1 && finalword.length() != 0) {
finalword = dummyintermediate;
}
else {
@@ -274,10 +274,15 @@ public void applyTransliterationByEngine(final Event event) {
mCombinerChain.replace(startPosition, replacement.length(), replacement);
context += current;
if(context.length() > mTransliterationEngine.getContextLength()) {
if (context.length() > mTransliterationEngine.getContextLength()) {
context = context.substring(context.length() - mTransliterationEngine.getContextLength());
}
}
else if (mTransliterationEngine != null && Constants.CODE_DELETE == event.mKeyCode) {
if(finalword.length() == 0) {
finalword = finalword.substring(0, finalword.length() - 1);
}
}
}
/**

0 comments on commit 8d4fc51

Please sign in to comment.