File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -1801,13 +1801,13 @@ void onDrop(DragEvent event) {
18011801 mTextView .deleteText_internal (dragSourceStart , dragSourceEnd );
18021802
18031803 // Make sure we do not leave two adjacent spaces.
1804- CharSequence t = mTextView . getTransformedText ( dragSourceStart - 1 , dragSourceStart + 1 );
1805- if ( ( dragSourceStart == 0 || Character . isSpaceChar ( t . charAt ( 0 ))) &&
1806- ( dragSourceStart == mTextView . getText (). length () ||
1807- Character . isSpaceChar ( t . charAt ( 1 ))) ) {
1808- final int pos = dragSourceStart == mTextView . getText (). length () ?
1809- dragSourceStart - 1 : dragSourceStart ;
1810- mTextView . deleteText_internal ( pos , pos + 1 );
1804+ final int prevCharIdx = Math . max ( 0 , dragSourceStart - 1 );
1805+ final int nextCharIdx = Math . min ( mTextView . getText (). length (), dragSourceStart + 1 );
1806+ if ( nextCharIdx > prevCharIdx + 1 ) {
1807+ CharSequence t = mTextView . getTransformedText ( prevCharIdx , nextCharIdx );
1808+ if ( Character . isSpaceChar ( t . charAt ( 0 )) && Character . isSpaceChar ( t . charAt ( 1 ))) {
1809+ mTextView . deleteText_internal ( prevCharIdx , prevCharIdx + 1 ) ;
1810+ }
18111811 }
18121812 }
18131813 }
You can’t perform that action at this time.
0 commit comments