Recomposing in ideographic mode is now possible only after deleting whitespace. It was way too aggressive and confusing when deleting a word and there was no space between it and the previous word
This commit is contained in:
parent
8a960713ab
commit
e20f1df2db
3 changed files with 14 additions and 2 deletions
|
|
@ -129,6 +129,8 @@ public abstract class TypingHandler extends KeyPadHandler {
|
|||
return true;
|
||||
}
|
||||
|
||||
mInputMode.beforeDeleteText();
|
||||
|
||||
boolean noTextSelection = textSelection.isEmpty(); // loading words after deleting selected text is confusing
|
||||
if (repeat == 0 && mInputMode.onBackspace() && noTextSelection) {
|
||||
getSuggestions(null);
|
||||
|
|
|
|||
|
|
@ -167,6 +167,7 @@ abstract public class InputMode {
|
|||
public boolean shouldReplaceLastLetter(int nextKey, boolean hold) { return false; }
|
||||
public boolean shouldSelectNextSuggestion() { return false; }
|
||||
|
||||
public void beforeDeleteText() {}
|
||||
public String recompose() { return null; }
|
||||
public void replaceLastLetter() {}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ public class ModeIdeograms extends ModeWords {
|
|||
private boolean isFiltering = false;
|
||||
@NonNull private String lastAcceptedSequence = "";
|
||||
@NonNull private String lastAcceptedWord = "";
|
||||
@NonNull private String lastTextBeforeDelete = "";
|
||||
|
||||
|
||||
protected ModeIdeograms(SettingsStore settings, Language lang, InputType inputType, TextField textField) {
|
||||
|
|
@ -78,6 +79,13 @@ public class ModeIdeograms extends ModeWords {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void beforeDeleteText() {
|
||||
String textBefore = textField.getComposingText();
|
||||
lastTextBeforeDelete = textBefore.isEmpty() ? textField.getStringBeforeCursor(1) : textBefore;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String recompose() {
|
||||
if (lastAcceptedWord.isEmpty()) {
|
||||
|
|
@ -85,12 +93,13 @@ public class ModeIdeograms extends ModeWords {
|
|||
}
|
||||
|
||||
String before = textField.getStringBeforeCursor(lastAcceptedWord.length());
|
||||
if (lastAcceptedWord.equals(before)) {
|
||||
char after = lastTextBeforeDelete.isEmpty() ? 0 : lastTextBeforeDelete.charAt(0);
|
||||
if (lastAcceptedWord.equals(before) && Character.isWhitespace(after)) {
|
||||
reset();
|
||||
digitSequence = lastAcceptedSequence;
|
||||
return lastAcceptedWord;
|
||||
} else {
|
||||
Logger.d(LOG_TAG, "Not recomposing word: '" + before + "' != last word: '" + lastAcceptedWord + "'");
|
||||
Logger.d(LOG_TAG, "Not recomposing word: '" + before + "' != last word: '" + lastAcceptedWord + "' and followed by: '" + after + "'");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue