make sure selection start is before end

this should not be necessary according to documentation, but apparently there are apps (even by Google!) that can't deal with documented behavior
see comments in GH-1512
This commit is contained in:
Helium314 2025-06-13 20:49:53 +02:00
parent e9e3bdac17
commit f06a553d2c

View file

@ -716,8 +716,13 @@ public final class RichInputConnection implements PrivateCommandPerformer {
if (start < 0 || end < 0) { if (start < 0 || end < 0) {
return false; return false;
} }
mExpectedSelStart = start; if (start > end) {
mExpectedSelEnd = end; mExpectedSelStart = end;
mExpectedSelEnd = start;
} else {
mExpectedSelStart = start;
mExpectedSelEnd = end;
}
if (isConnected()) { if (isConnected()) {
final boolean isIcValid = mIC.setSelection(start, end); final boolean isIcValid = mIC.setSelection(start, end);
if (!isIcValid) { if (!isIcValid) {