Lines Matching refs:start

55     public SpannableStringBuilder(CharSequence text, int start, int end) {
56 int srclen = end - start;
64 TextUtils.getChars(text, start, end, mText, 0);
74 Object[] spans = sp.getSpans(start, end, Object.class);
81 int st = sp.getSpanStart(spans[i]) - start;
82 int en = sp.getSpanEnd(spans[i]) - start;
87 if (st > end - start)
88 st = end - start;
92 if (en > end - start)
93 en = end - start;
172 int start = mSpanStarts[i];
175 if (start > mGapStart)
176 start -= mGapLength;
177 if (start > where)
178 start += mGapLength;
179 else if (start == where) {
183 start += mGapLength;
197 mSpanStarts[i] = start;
205 public SpannableStringBuilder insert(int where, CharSequence tb, int start, int end) {
206 return replace(where, where, tb, start, end);
215 public SpannableStringBuilder delete(int start, int end) {
216 SpannableStringBuilder ret = replace(start, end, "", 0, 0);
263 int start = length();
265 setSpan(what, start, length(), flags);
270 public SpannableStringBuilder append(CharSequence text, int start, int end) {
272 return replace(length, length, text, start, end);
280 private void change(int start, int end, CharSequence cs, int csStart, int csEnd) {
282 final int replacedLength = end - start;
300 if (spanStart > start && spanStart <= end) {
306 if (spanEnd > start && spanEnd <= end) {
317 if (spanStart == start) flags |= SPAN_START_AT_START;
319 if (spanEnd == start) flags |= SPAN_END_AT_START;
342 mSpanStarts[i] >= start && mSpanStarts[i] < mGapStart + mGapLength &&
343 mSpanEnds[i] >= start && mSpanEnds[i] < mGapStart + mGapLength &&
345 (textIsRemoved || mSpanStarts[i] > start || mSpanEnds[i] < mGapStart)) {
360 TextUtils.getChars(cs, csStart, csEnd, mText, start);
367 mSpanStarts[i] = updatedIntervalBound(mSpanStarts[i], start, nbNewChars, startFlag,
371 mSpanEnds[i] = updatedIntervalBound(mSpanEnds[i], start, nbNewChars, endFlag,
391 setSpan(false, spans[i], st - csStart + start, en - csStart + start,
398 private int updatedIntervalBound(int offset, int start, int nbNewChars, int flag, boolean atEnd,
400 if (offset >= start && offset < mGapStart + mGapLength) {
404 // The exception is when the point is at the start of the range and we are doing a
406 if (textIsRemoved || offset > start) {
415 // MARKs should be moved to the start, with the exception of a mark located at
419 return start;
433 int start = mSpanStarts[i];
436 if (start > mGapStart) start -= mGapLength;
449 sendSpanRemoved(object, start, end);
453 public SpannableStringBuilder replace(int start, int end, CharSequence tb) {
454 return replace(start, end, tb, 0, tb.length());
458 public SpannableStringBuilder replace(final int start, final int end,
460 checkRange("replace", start, end);
464 CharSequence repl = mFilters[i].filter(tb, tbstart, tbend, this, start, end);
473 final int origLen = end - start;
482 TextWatcher[] textWatchers = getSpans(start, start + origLen, TextWatcher.class);
483 sendBeforeTextChanged(textWatchers, start, origLen, newLen);
496 change(start, end, tb, tbstart, tbend);
499 if (selectionStart > start && selectionStart < end) {
500 final int offset = (selectionStart - start) * newLen / origLen;
501 selectionStart = start + offset;
506 if (selectionEnd > start && selectionEnd < end) {
507 final int offset = (selectionEnd - start) * newLen / origLen;
508 selectionEnd = start + offset;
515 sendTextChanged(textWatchers, start, origLen, newLen);
519 sendToSpanWatchers(start, end, newLen - origLen);
556 // No change if span start was already at replace interval boundaries before replace
575 // No change if span start was already at replace interval boundaries before replace
604 * inserted at the start or end of the span's range.
606 public void setSpan(Object what, int start, int end, int flags) {
607 setSpan(true, what, start, end, flags);
610 private void setSpan(boolean send, Object what, int start, int end, int flags) {
611 checkRange("setSpan", start, end);
615 if (start != 0 && start != length()) {
616 char c = charAt(start - 1);
619 throw new RuntimeException("PARAGRAPH span must start at paragraph boundary");
634 if (flagsStart == POINT && flagsEnd == MARK && start == end) {
644 int nstart = start;
647 if (start > mGapStart) {
648 start += mGapLength;
649 } else if (start == mGapStart) {
650 if (flagsStart == POINT || (flagsStart == PARAGRAPH && start == length()))
651 start += mGapLength;
674 mSpanStarts[i] = start;
685 mSpanStarts = GrowingArrayUtils.append(mSpanStarts, mSpanCount, start);
868 * Return the next offset after <code>start</code> but less than or
872 public int nextSpanTransition(int start, int limit, Class kind) {
893 if (st > start && st < limit && kind.isInstance(spans[i]))
895 if (en > start && en < limit && kind.isInstance(spans[i]))
906 public CharSequence subSequence(int start, int end) {
907 return new SpannableStringBuilder(this, start, end);
914 public void getChars(int start, int end, char[] dest, int destoff) {
915 checkRange("getChars", start, end);
918 System.arraycopy(mText, start, dest, destoff, end - start);
919 } else if (start >= mGapStart) {
920 System.arraycopy(mText, start + mGapLength, dest, destoff, end - start);
922 System.arraycopy(mText, start, dest, destoff, mGapStart - start);
924 dest, destoff + (mGapStart - start),
943 * [start, end[ range.
946 public String substring(int start, int end) {
947 char[] buf = new char[end - start];
948 getChars(start, end, buf, 0);
952 private void sendBeforeTextChanged(TextWatcher[] watchers, int start, int before, int after) {
956 watchers[i].beforeTextChanged(this, start, before, after);
960 private void sendTextChanged(TextWatcher[] watchers, int start, int before, int after) {
964 watchers[i].onTextChanged(this, start, before, after);
976 private void sendSpanAdded(Object what, int start, int end) {
977 SpanWatcher[] recip = getSpans(start, end, SpanWatcher.class);
981 recip[i].onSpanAdded(this, what, start, end);
985 private void sendSpanRemoved(Object what, int start, int end) {
986 SpanWatcher[] recip = getSpans(start, end, SpanWatcher.class);
990 recip[i].onSpanRemoved(this, what, start, end);
994 private void sendSpanChanged(Object what, int oldStart, int oldEnd, int start, int end) {
997 SpanWatcher[] spanWatchers = getSpans(Math.min(oldStart, start),
1001 spanWatchers[i].onSpanChanged(this, what, oldStart, oldEnd, start, end);
1005 private static String region(int start, int end) {
1006 return "(" + start + " ... " + end + ")";
1009 private void checkRange(final String operation, int start, int end) {
1010 if (end < start) {
1012 region(start, end) + " has end before start");
1017 if (start > len || end > len) {
1019 region(start, end) + " ends beyond length " + len);
1022 if (start < 0 || end < 0) {
1024 region(start, end) + " starts before 0");
1113 public void drawText(Canvas c, int start, int end, float x, float y, Paint p) {
1114 checkRange("drawText", start, end);
1117 c.drawText(mText, start, end - start, x, y, p);
1118 } else if (start >= mGapStart) {
1119 c.drawText(mText, start + mGapLength, end - start, x, y, p);
1121 char[] buf = TextUtils.obtain(end - start);
1123 getChars(start, end, buf, 0);
1124 c.drawText(buf, 0, end - start, x, y, p);
1134 public void drawTextRun(Canvas c, int start, int end, int contextStart, int contextEnd,
1136 checkRange("drawTextRun", start, end);
1139 int len = end - start;
1141 c.drawTextRun(mText, start, len, contextStart, contextLen, x, y, isRtl, p);
1143 c.drawTextRun(mText, start + mGapLength, len, contextStart + mGapLength,
1148 c.drawTextRun(buf, start - contextStart, len, 0, contextLen, x, y, isRtl, p);
1157 public float measureText(int start, int end, Paint p) {
1158 checkRange("measureText", start, end);
1163 ret = p.measureText(mText, start, end - start);
1164 } else if (start >= mGapStart) {
1165 ret = p.measureText(mText, start + mGapLength, end - start);
1167 char[] buf = TextUtils.obtain(end - start);
1169 getChars(start, end, buf, 0);
1170 ret = p.measureText(buf, 0, end - start);
1181 public int getTextWidths(int start, int end, float[] widths, Paint p) {
1182 checkRange("getTextWidths", start, end);
1187 ret = p.getTextWidths(mText, start, end - start, widths);
1188 } else if (start >= mGapStart) {
1189 ret = p.getTextWidths(mText, start + mGapLength, end - start, widths);
1191 char[] buf = TextUtils.obtain(end - start);
1193 getChars(start, end, buf, 0);
1194 ret = p.getTextWidths(buf, 0, end - start, widths);
1205 public float getTextRunAdvances(int start, int end, int contextStart, int contextEnd, boolean isRtl,
1211 int len = end - start;
1214 ret = p.getTextRunAdvances(mText, start, len, contextStart, contextLen,
1216 } else if (start >= mGapStart) {
1217 ret = p.getTextRunAdvances(mText, start + mGapLength, len,
1222 ret = p.getTextRunAdvances(buf, start - contextStart, len,
1238 * the start of the string.</p>
1244 * @param contextStart the start index of the context