fixed fast-delete deleting too much text in languages without spaces, when there is composing text
This commit is contained in:
parent
77bbae05d1
commit
f594a6f258
2 changed files with 13 additions and 4 deletions
|
|
@ -245,12 +245,15 @@ public abstract class TypingHandler extends KeyPadHandler {
|
|||
|
||||
private void deleteText(boolean deleteMany) {
|
||||
int charsToDelete = 1;
|
||||
if (deleteMany) {
|
||||
charsToDelete = Math.max(textField.getPaddedWordBeforeCursorLength(), 1);
|
||||
} else if (!textSelection.isEmpty()) {
|
||||
|
||||
if (!textSelection.isEmpty()) {
|
||||
charsToDelete = textSelection.length();
|
||||
textSelection.clear(false);
|
||||
} else if (deleteMany) {
|
||||
charsToDelete = textField.getComposingText().length();
|
||||
charsToDelete = charsToDelete > 0 ? charsToDelete : Math.max(textField.getPaddedWordBeforeCursorLength(), 1);
|
||||
}
|
||||
|
||||
textField.deleteChars(charsToDelete);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import io.github.sspanak.tt9.util.Logger;
|
|||
import io.github.sspanak.tt9.util.Text;
|
||||
|
||||
public class TextField extends InputField {
|
||||
private CharSequence composingText = "";
|
||||
@NonNull private CharSequence composingText = "";
|
||||
private final boolean isComposingSupported;
|
||||
private final boolean isNonText;
|
||||
|
||||
|
|
@ -231,6 +231,12 @@ public class TextField extends InputField {
|
|||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
public String getComposingText() {
|
||||
return composingText.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* setComposingText
|
||||
* A fail-safe setter for composing text, which ignores NULL input.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue