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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mInputMode.beforeDeleteText();
|
||||||
|
|
||||||
boolean noTextSelection = textSelection.isEmpty(); // loading words after deleting selected text is confusing
|
boolean noTextSelection = textSelection.isEmpty(); // loading words after deleting selected text is confusing
|
||||||
if (repeat == 0 && mInputMode.onBackspace() && noTextSelection) {
|
if (repeat == 0 && mInputMode.onBackspace() && noTextSelection) {
|
||||||
getSuggestions(null);
|
getSuggestions(null);
|
||||||
|
|
|
||||||
|
|
@ -167,6 +167,7 @@ abstract public class InputMode {
|
||||||
public boolean shouldReplaceLastLetter(int nextKey, boolean hold) { return false; }
|
public boolean shouldReplaceLastLetter(int nextKey, boolean hold) { return false; }
|
||||||
public boolean shouldSelectNextSuggestion() { return false; }
|
public boolean shouldSelectNextSuggestion() { return false; }
|
||||||
|
|
||||||
|
public void beforeDeleteText() {}
|
||||||
public String recompose() { return null; }
|
public String recompose() { return null; }
|
||||||
public void replaceLastLetter() {}
|
public void replaceLastLetter() {}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ public class ModeIdeograms extends ModeWords {
|
||||||
private boolean isFiltering = false;
|
private boolean isFiltering = false;
|
||||||
@NonNull private String lastAcceptedSequence = "";
|
@NonNull private String lastAcceptedSequence = "";
|
||||||
@NonNull private String lastAcceptedWord = "";
|
@NonNull private String lastAcceptedWord = "";
|
||||||
|
@NonNull private String lastTextBeforeDelete = "";
|
||||||
|
|
||||||
|
|
||||||
protected ModeIdeograms(SettingsStore settings, Language lang, InputType inputType, TextField textField) {
|
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
|
@Override
|
||||||
public String recompose() {
|
public String recompose() {
|
||||||
if (lastAcceptedWord.isEmpty()) {
|
if (lastAcceptedWord.isEmpty()) {
|
||||||
|
|
@ -85,12 +93,13 @@ public class ModeIdeograms extends ModeWords {
|
||||||
}
|
}
|
||||||
|
|
||||||
String before = textField.getStringBeforeCursor(lastAcceptedWord.length());
|
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();
|
reset();
|
||||||
digitSequence = lastAcceptedSequence;
|
digitSequence = lastAcceptedSequence;
|
||||||
return lastAcceptedWord;
|
return lastAcceptedWord;
|
||||||
} else {
|
} 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;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue