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

Commit af6cf8c7 authored by Haoyu Zhang's avatar Haoyu Zhang Committed by Automerger Merge Worker
Browse files

Merge "Fix insert mode draws extra rectangle at the end of the first line"...

Merge "Fix insert mode draws extra rectangle at the end of the first line" into udc-dev am: 4a0f969c am: 20aec8b8

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22517562



Change-Id: Iccacc70d5a61c5e3b07dc52b75f69c54ac6101b5
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents f6784223 20aec8b8
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -8095,12 +8095,14 @@ public class Editor {
        private boolean mIsInsertModeActive;
        private InsertModeTransformationMethod mInsertModeTransformationMethod;
        private final Paint mHighlightPaint;
        private final Path mHighlightPath;

        InsertModeController(@NonNull TextView textView) {
            mTextView = Objects.requireNonNull(textView);
            mIsInsertModeActive = false;
            mInsertModeTransformationMethod = null;
            mHighlightPaint = new Paint();
            mHighlightPath = new Path();

            // The highlight color is supposed to be 12% of the color primary40. We can't
            // directly access Material 3 theme. But because Material 3 sets the colorPrimary to
@@ -8168,10 +8170,8 @@ public class Editor {
                        ((InsertModeTransformationMethod.TransformedText) transformedText);
                final int highlightStart = insertModeTransformedText.getHighlightStart();
                final int highlightEnd = insertModeTransformedText.getHighlightEnd();
                final Layout.SelectionRectangleConsumer consumer =
                        (left, top, right, bottom, textSelectionLayout) ->
                                canvas.drawRect(left, top, right, bottom, mHighlightPaint);
                layout.getSelection(highlightStart, highlightEnd, consumer);
                layout.getSelectionPath(highlightStart, highlightEnd, mHighlightPath);
                canvas.drawPath(mHighlightPath, mHighlightPaint);
            }
        }