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

Commit 976ed471 authored by Victoria Lease's avatar Victoria Lease Committed by Android Git Automerger
Browse files

am d6991106: Merge "Avert crash when dragging text in same TextView" into jb-mr1-dev

* commit 'd6991106':
  Avert crash when dragging text in same TextView
parents 97b927a6 d6991106
Loading
Loading
Loading
Loading
+7 −7
Original line number Original line Diff line number Diff line
@@ -1801,13 +1801,13 @@ public class Editor {
            mTextView.deleteText_internal(dragSourceStart, dragSourceEnd);
            mTextView.deleteText_internal(dragSourceStart, dragSourceEnd);


            // Make sure we do not leave two adjacent spaces.
            // Make sure we do not leave two adjacent spaces.
            CharSequence t = mTextView.getTransformedText(dragSourceStart - 1, dragSourceStart + 1);
            final int prevCharIdx = Math.max(0,  dragSourceStart - 1);
            if ( (dragSourceStart == 0 || Character.isSpaceChar(t.charAt(0))) &&
            final int nextCharIdx = Math.min(mTextView.getText().length(), dragSourceStart + 1);
                    (dragSourceStart == mTextView.getText().length() ||
            if (nextCharIdx > prevCharIdx + 1) {
                    Character.isSpaceChar(t.charAt(1))) ) {
                CharSequence t = mTextView.getTransformedText(prevCharIdx, nextCharIdx);
                final int pos = dragSourceStart == mTextView.getText().length() ?
                if (Character.isSpaceChar(t.charAt(0)) && Character.isSpaceChar(t.charAt(1))) {
                        dragSourceStart - 1 : dragSourceStart;
                    mTextView.deleteText_internal(prevCharIdx, prevCharIdx + 1);
                mTextView.deleteText_internal(pos, pos + 1);
                }
            }
            }
        }
        }
    }
    }