|
26 | 26 |
|
27 | 27 | import com.duy.common.DLog; |
28 | 28 |
|
29 | | -import java.util.Arrays; |
30 | | - |
31 | 29 | public class LineManager { |
32 | 30 | private static final Rect BOUND = new Rect(); |
33 | 31 | private static final String TAG = "LineManager"; |
@@ -131,10 +129,16 @@ public void updateRealLines(int startLine) { |
131 | 129 | } |
132 | 130 | //in some case, edit text not init and return line count is 0 |
133 | 131 | lineCount = Math.max(lineCount, 1); |
134 | | - |
135 | 132 | if (mIsStartRealLine != null) { |
136 | | - mIsStartRealLine = Arrays.copyOf(mIsStartRealLine, lineCount); |
137 | | - mRealLines = Arrays.copyOf(mRealLines, lineCount); |
| 133 | + boolean[] dest = new boolean[lineCount]; |
| 134 | + System.arraycopy(mIsStartRealLine, 0, dest, 0, |
| 135 | + Math.max(0, Math.min(mIsStartRealLine.length, startLine - 1))); |
| 136 | + mIsStartRealLine = dest; |
| 137 | + |
| 138 | + int[] dest2 = new int[lineCount]; |
| 139 | + System.arraycopy(mRealLines, 0, dest2, 0, |
| 140 | + Math.max(0, Math.min(mRealLines.length, startLine - 1))); |
| 141 | + mRealLines = dest2; |
138 | 142 | } else { |
139 | 143 | mIsStartRealLine = new boolean[lineCount]; |
140 | 144 | mRealLines = new int[lineCount]; |
|
0 commit comments