Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c99d33fb authored by Jean Chalard's avatar Jean Chalard
Browse files

Actually change the place where updateSelection is called

Call updateSelection in endBatchEdit instead of onDraw.
This works because all edits go through a batch edit,
which is already the case although the next change will
enforce it going forward.
This is step 3 of a four-step refactoring.

Bug: 8000119
Change-Id: Ia5e257382e2ef2168726bf3d9c7c84f9379ba376
parent baf3094e
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -1085,9 +1085,12 @@ public class Editor {
            mTextView.updateAfterEdit();
            reportExtractedText();
        } else if (ims.mCursorChanged) {
            // Cheezy way to get us to report the current cursor location.
            // Cheesy way to get us to report the current cursor location.
            mTextView.invalidateCursor();
        }
        // sendUpdateSelection knows to avoid sending if the selection did
        // not actually change.
        sendUpdateSelection();
    }

    static final int EXTRACT_NOTHING = -2;
@@ -1221,6 +1224,8 @@ public class Editor {
                    candStart = EditableInputConnection.getComposingSpanStart(sp);
                    candEnd = EditableInputConnection.getComposingSpanEnd(sp);
                }
                // InputMethodManager#updateSelection skips sending the message if
                // none of the parameters have changed since the last time we called it.
                imm.updateSelection(mTextView,
                        selectionStart, selectionEnd, candStart, candEnd);
            }
@@ -1244,11 +1249,6 @@ public class Editor {
                        // input method.
                        reported = reportExtractedText();
                    }
                    if (!reported && highlight != null) {
                        // TODO: stop doing this here, and do it after each change
                        // as needed instead.
                        sendUpdateSelection();
                    }
                }

                if (imm.isWatchingCursor(mTextView) && highlight != null) {