Lines Matching refs:start

51     public SpannableStringBuilder(CharSequence text, int start, int end) {
52 int srclen = end - start;
61 TextUtils.getChars(text, start, end, mText, 0);
72 Object[] spans = sp.getSpans(start, end, Object.class);
79 int st = sp.getSpanStart(spans[i]) - start;
80 int en = sp.getSpanEnd(spans[i]) - start;
85 if (st > end - start)
86 st = end - start;
90 if (en > end - start)
91 en = end - start;
168 int start = mSpanStarts[i];
171 if (start > mGapStart)
172 start -= mGapLength;
173 if (start > where)
174 start += mGapLength;
175 else if (start == where) {
179 start += mGapLength;
193 mSpanStarts[i] = start;
201 public SpannableStringBuilder insert(int where, CharSequence tb, int start, int end) {
202 return replace(where, where, tb, start, end);
211 public SpannableStringBuilder delete(int start, int end) {
212 SpannableStringBuilder ret = replace(start, end, "", 0, 0);
251 public SpannableStringBuilder append(CharSequence text, int start, int end) {
253 return replace(length, length, text, start, end);
261 private void change(int start, int end, CharSequence cs, int csStart, int csEnd) {
263 final int replacedLength = end - start;
281 if (spanStart > start && spanStart <= end) {
287 if (spanEnd > start && spanEnd <= end) {
298 if (spanStart == start) flags |= SPAN_START_AT_START;
300 if (spanEnd == start) flags |= SPAN_END_AT_START;
323 mSpanStarts[i] >= start && mSpanStarts[i] < mGapStart + mGapLength &&
324 mSpanEnds[i] >= start && mSpanEnds[i] < mGapStart + mGapLength &&
326 (textIsRemoved || mSpanStarts[i] > start || mSpanEnds[i] < mGapStart)) {
341 TextUtils.getChars(cs, csStart, csEnd, mText, start);
348 mSpanStarts[i] = updatedIntervalBound(mSpanStarts[i], start, nbNewChars, startFlag,
352 mSpanEnds[i] = updatedIntervalBound(mSpanEnds[i], start, nbNewChars, endFlag,
372 setSpan(false, spans[i], st - csStart + start, en - csStart + start,
379 private int updatedIntervalBound(int offset, int start, int nbNewChars, int flag, boolean atEnd,
381 if (offset >= start && offset < mGapStart + mGapLength) {
385 // The exception is when the point is at the start of the range and we are doing a
387 if (textIsRemoved || offset > start) {
396 // MARKs should be moved to the start, with the exception of a mark located at
400 return start;
414 int start = mSpanStarts[i];
417 if (start > mGapStart) start -= mGapLength;
430 sendSpanRemoved(object, start, end);
434 public SpannableStringBuilder replace(int start, int end, CharSequence tb) {
435 return replace(start, end, tb, 0, tb.length());
439 public SpannableStringBuilder replace(final int start, final int end,
441 checkRange("replace", start, end);
445 CharSequence repl = mFilters[i].filter(tb, tbstart, tbend, this, start, end);
454 final int origLen = end - start;
463 TextWatcher[] textWatchers = getSpans(start, start + origLen, TextWatcher.class);
464 sendBeforeTextChanged(textWatchers, start, origLen, newLen);
477 change(start, end, tb, tbstart, tbend);
480 if (selectionStart > start && selectionStart < end) {
481 final int offset = (selectionStart - start) * newLen / origLen;
482 selectionStart = start + offset;
487 if (selectionEnd > start && selectionEnd < end) {
488 final int offset = (selectionEnd - start) * newLen / origLen;
489 selectionEnd = start + offset;
496 sendTextChanged(textWatchers, start, origLen, newLen);
500 sendToSpanWatchers(start, end, newLen - origLen);
537 // No change if span start was already at replace interval boundaries before replace
556 // No change if span start was already at replace interval boundaries before replace
585 * inserted at the start or end of the span's range.
587 public void setSpan(Object what, int start, int end, int flags) {
588 setSpan(true, what, start, end, flags);
591 private void setSpan(boolean send, Object what, int start, int end, int flags) {
592 checkRange("setSpan", start, end);
596 if (start != 0 && start != length()) {
597 char c = charAt(start - 1);
600 throw new RuntimeException("PARAGRAPH span must start at paragraph boundary");
615 if (flagsStart == POINT && flagsEnd == MARK && start == end) {
624 int nstart = start;
627 if (start > mGapStart) {
628 start += mGapLength;
629 } else if (start == mGapStart) {
630 if (flagsStart == POINT || (flagsStart == PARAGRAPH && start == length()))
631 start += mGapLength;
654 mSpanStarts[i] = start;
683 mSpanStarts[mSpanCount] = start;
866 * Return the next offset after <code>start</code> but less than or
870 public int nextSpanTransition(int start, int limit, Class kind) {
891 if (st > start && st < limit && kind.isInstance(spans[i]))
893 if (en > start && en < limit && kind.isInstance(spans[i]))
904 public CharSequence subSequence(int start, int end) {
905 return new SpannableStringBuilder(this, start, end);
912 public void getChars(int start, int end, char[] dest, int destoff) {
913 checkRange("getChars", start, end);
916 System.arraycopy(mText, start, dest, destoff, end - start);
917 } else if (start >= mGapStart) {
918 System.arraycopy(mText, start + mGapLength, dest, destoff, end - start);
920 System.arraycopy(mText, start, dest, destoff, mGapStart - start);
922 dest, destoff + (mGapStart - start),
941 * [start, end[ range.
944 public String substring(int start, int end) {
945 char[] buf = new char[end - start];
946 getChars(start, end, buf, 0);
950 private void sendBeforeTextChanged(TextWatcher[] watchers, int start, int before, int after) {
954 watchers[i].beforeTextChanged(this, start, before, after);
958 private void sendTextChanged(TextWatcher[] watchers, int start, int before, int after) {
962 watchers[i].onTextChanged(this, start, before, after);
974 private void sendSpanAdded(Object what, int start, int end) {
975 SpanWatcher[] recip = getSpans(start, end, SpanWatcher.class);
979 recip[i].onSpanAdded(this, what, start, end);
983 private void sendSpanRemoved(Object what, int start, int end) {
984 SpanWatcher[] recip = getSpans(start, end, SpanWatcher.class);
988 recip[i].onSpanRemoved(this, what, start, end);
992 private void sendSpanChanged(Object what, int oldStart, int oldEnd, int start, int end) {
995 SpanWatcher[] spanWatchers = getSpans(Math.min(oldStart, start),
999 spanWatchers[i].onSpanChanged(this, what, oldStart, oldEnd, start, end);
1003 private static String region(int start, int end) {
1004 return "(" + start + " ... " + end + ")";
1007 private void checkRange(final String operation, int start, int end) {
1008 if (end < start) {
1010 region(start, end) + " has end before start");
1015 if (start > len || end > len) {
1017 region(start, end) + " ends beyond length " + len);
1020 if (start < 0 || end < 0) {
1022 region(start, end) + " starts before 0");
1111 public void drawText(Canvas c, int start, int end, float x, float y, Paint p) {
1112 checkRange("drawText", start, end);
1115 c.drawText(mText, start, end - start, x, y, p);
1116 } else if (start >= mGapStart) {
1117 c.drawText(mText, start + mGapLength, end - start, x, y, p);
1119 char[] buf = TextUtils.obtain(end - start);
1121 getChars(start, end, buf, 0);
1122 c.drawText(buf, 0, end - start, x, y, p);
1132 public void drawTextRun(Canvas c, int start, int end, int contextStart, int contextEnd,
1134 checkRange("drawTextRun", start, end);
1137 int len = end - start;
1139 c.drawTextRun(mText, start, len, contextStart, contextLen, x, y, flags, p);
1141 c.drawTextRun(mText, start + mGapLength, len, contextStart + mGapLength,
1146 c.drawTextRun(buf, start - contextStart, len, 0, contextLen, x, y, flags, p);
1155 public float measureText(int start, int end, Paint p) {
1156 checkRange("measureText", start, end);
1161 ret = p.measureText(mText, start, end - start);
1162 } else if (start >= mGapStart) {
1163 ret = p.measureText(mText, start + mGapLength, end - start);
1165 char[] buf = TextUtils.obtain(end - start);
1167 getChars(start, end, buf, 0);
1168 ret = p.measureText(buf, 0, end - start);
1179 public int getTextWidths(int start, int end, float[] widths, Paint p) {
1180 checkRange("getTextWidths", start, end);
1185 ret = p.getTextWidths(mText, start, end - start, widths);
1186 } else if (start >= mGapStart) {
1187 ret = p.getTextWidths(mText, start + mGapLength, end - start, widths);
1189 char[] buf = TextUtils.obtain(end - start);
1191 getChars(start, end, buf, 0);
1192 ret = p.getTextWidths(buf, 0, end - start, widths);
1203 public float getTextRunAdvances(int start, int end, int contextStart, int contextEnd, int flags,
1209 int len = end - start;
1212 ret = p.getTextRunAdvances(mText, start, len, contextStart, contextLen,
1214 } else if (start >= mGapStart) {
1215 ret = p.getTextRunAdvances(mText, start + mGapLength, len,
1220 ret = p.getTextRunAdvances(buf, start - contextStart, len,
1232 public float getTextRunAdvances(int start, int end, int contextStart, int contextEnd, int flags,
1238 int len = end - start;
1241 ret = p.getTextRunAdvances(mText, start, len, contextStart, contextLen,
1243 } else if (start >= mGapStart) {
1244 ret = p.getTextRunAdvances(mText, start + mGapLength, len,
1249 ret = p.getTextRunAdvances(buf, start - contextStart, len,
1265 * the start of the string.</p>
1271 * @param contextStart the start index of the context