fixed Backspace not deleting selected text
This commit is contained in:
parent
77f4803dc4
commit
7fb509604e
3 changed files with 16 additions and 2 deletions
|
|
@ -135,7 +135,16 @@ public abstract class TypingHandler extends KeyPadHandler {
|
|||
suggestionOps.commitCurrent(false);
|
||||
mInputMode.reset();
|
||||
|
||||
int charsToDelete = settings.getBackspaceAcceleration() && repeat > 0 ? Math.max(textField.getPaddedWordBeforeCursorLength(), 1) : 1;
|
||||
int charsToDelete;
|
||||
|
||||
if (settings.getBackspaceAcceleration() && repeat > 0) {
|
||||
charsToDelete = Math.max(textField.getPaddedWordBeforeCursorLength(), 1);
|
||||
} else if (!textSelection.isEmpty()) {
|
||||
charsToDelete = textSelection.length();
|
||||
textSelection.clear(false);
|
||||
} else {
|
||||
charsToDelete = 1;
|
||||
}
|
||||
textField.deleteChars(charsToDelete);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ public class TextField extends InputField {
|
|||
* "deleteSurroundingText()" to delete a region of text or a Unicode character.
|
||||
*/
|
||||
public void deleteChars(int numberOfChars) {
|
||||
if (numberOfChars < 0 || connection == null) {
|
||||
if (numberOfChars <= 0 || connection == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,6 +52,11 @@ public class TextSelection {
|
|||
}
|
||||
|
||||
|
||||
public int length() {
|
||||
return Math.abs(currentEnd - currentStart);
|
||||
}
|
||||
|
||||
|
||||
public void selectAll() {
|
||||
if (connection != null) {
|
||||
connection.performContextMenuAction(android.R.id.selectAll);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue