mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Some clean up and fixes around auto-correction cancellation logic
Change-Id: I07f4c3cd98d14d9f0da2de54bfa76a3867389f6f
This commit is contained in:
parent
ffefdb6c1a
commit
9ae24750f4
@ -1181,7 +1181,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
|||||||
|
|
||||||
mVoiceProxy.handleBackspace();
|
mVoiceProxy.handleBackspace();
|
||||||
|
|
||||||
boolean deleteChar = false;
|
final boolean deleteChar = !mHasUncommittedTypedChars;
|
||||||
if (mHasUncommittedTypedChars) {
|
if (mHasUncommittedTypedChars) {
|
||||||
final int length = mComposing.length();
|
final int length = mComposing.length();
|
||||||
if (length > 0) {
|
if (length > 0) {
|
||||||
@ -1202,8 +1202,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
|||||||
} else {
|
} else {
|
||||||
ic.deleteSurroundingText(1, 0);
|
ic.deleteSurroundingText(1, 0);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
deleteChar = true;
|
|
||||||
}
|
}
|
||||||
mHandler.postUpdateShiftKeyState();
|
mHandler.postUpdateShiftKeyState();
|
||||||
|
|
||||||
@ -1231,7 +1229,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
|||||||
// different behavior only in the case of picking the first
|
// different behavior only in the case of picking the first
|
||||||
// suggestion (typed word). It's intentional to have made this
|
// suggestion (typed word). It's intentional to have made this
|
||||||
// inconsistent with backspacing after selecting other suggestions.
|
// inconsistent with backspacing after selecting other suggestions.
|
||||||
revertLastWord(deleteChar);
|
revertLastWord(true /* deleteChar */);
|
||||||
} else {
|
} else {
|
||||||
sendDownUpKeyEvents(KeyEvent.KEYCODE_DEL);
|
sendDownUpKeyEvents(KeyEvent.KEYCODE_DEL);
|
||||||
if (mDeleteCount > DELETE_ACCELERATE_AT) {
|
if (mDeleteCount > DELETE_ACCELERATE_AT) {
|
||||||
@ -1799,7 +1797,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
|||||||
return TextUtils.equals(text, beforeText);
|
return TextUtils.equals(text, beforeText);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void revertLastWord(boolean deleteChar) {
|
private void revertLastWord(boolean deleteChar) {
|
||||||
final int length = mComposing.length();
|
final int length = mComposing.length();
|
||||||
if (!mHasUncommittedTypedChars && length > 0) {
|
if (!mHasUncommittedTypedChars && length > 0) {
|
||||||
final InputConnection ic = getCurrentInputConnection();
|
final InputConnection ic = getCurrentInputConnection();
|
||||||
@ -1837,7 +1835,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean revertDoubleSpace() {
|
private boolean revertDoubleSpace() {
|
||||||
mHandler.cancelDoubleSpacesTimer();
|
mHandler.cancelDoubleSpacesTimer();
|
||||||
final InputConnection ic = getCurrentInputConnection();
|
final InputConnection ic = getCurrentInputConnection();
|
||||||
// Here we test whether we indeed have a period and a space before us. This should not
|
// Here we test whether we indeed have a period and a space before us. This should not
|
||||||
|
@ -144,7 +144,7 @@ public class TextEntryState {
|
|||||||
break;
|
break;
|
||||||
case UNDO_COMMIT:
|
case UNDO_COMMIT:
|
||||||
if (isSpace || isSeparator) {
|
if (isSpace || isSeparator) {
|
||||||
setState(ACCEPTED_DEFAULT);
|
setState(START);
|
||||||
} else {
|
} else {
|
||||||
setState(IN_WORD);
|
setState(IN_WORD);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user