Lines Matching refs:end

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);
85 if (st > end - start)
86 st = end - start;
90 if (en > end - start)
91 en = end - start;
169 int end = mSpanEnds[i];
182 if (end > mGapStart)
183 end -= mGapLength;
184 if (end > where)
185 end += mGapLength;
186 else if (end == where) {
190 end += mGapLength;
194 mSpanEnds[i] = end;
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) {
282 for (spanStart = end; spanStart < clen; spanStart++)
283 if (spanStart > end && charAt(spanStart - 1) == '\n')
287 if (spanEnd > start && spanEnd <= end) {
288 for (spanEnd = end; spanEnd < clen; spanEnd++)
289 if (spanEnd > end && charAt(spanEnd - 1) == '\n')
299 else if (spanStart == end + nbNewChars) flags |= SPAN_START_AT_END;
301 else if (spanEnd == end + nbNewChars) flags |= SPAN_END_AT_END;
305 moveGapTo(end);
383 // A POINT located inside the replaced range should be moved to the end of the
397 // the end of the range (which will be < mGapStart + mGapLength since mGapLength
398 // is > 0, which should stay 'unchanged' at the end of the replaced text.
402 // Move to the end of replaced text (needed if nbNewChars != 0)
415 int end = mSpanEnds[i];
418 if (end > mGapStart) end -= 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;
477 change(start, end, tb, tbstart, tbend);
480 if (selectionStart > start && selectionStart < end) {
487 if (selectionEnd > start && selectionEnd < end) {
500 sendToSpanWatchers(start, end, newLen - origLen);
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);
606 if (end != 0 && end != length()) {
607 char c = charAt(end - 1);
610 throw new RuntimeException("PARAGRAPH span must end at paragraph boundary");
615 if (flagsStart == POINT && flagsEnd == MARK && start == end) {
625 int nend = end;
634 if (end > mGapStart) {
635 end += mGapLength;
636 } else if (end == mGapStart) {
637 if (flagsEnd == POINT || (flagsEnd == PARAGRAPH && end == length()))
638 end += mGapLength;
655 mSpanEnds[i] = end;
684 mSpanEnds[mSpanCount] = end;
726 * Return the buffer offset of the end of the specified
748 * Return the flags of the end of the specified
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);
915 if (end <= mGapStart) {
916 System.arraycopy(mText, start, dest, destoff, end - start);
918 System.arraycopy(mText, start + mGapLength, dest, destoff, end - start);
923 end - mGapStart);
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);
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) {
996 Math.min(Math.max(oldEnd, end), length()), SpanWatcher.class);
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);
1114 if (end <= mGapStart) {
1115 c.drawText(mText, start, end - start, x, y, p);
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;
1155 public float measureText(int start, int end, Paint p) {
1156 checkRange("measureText", start, end);
1160 if (end <= mGapStart) {
1161 ret = p.measureText(mText, start, end - start);
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);
1184 if (end <= mGapStart) {
1185 ret = p.getTextWidths(mText, start, end - start, widths);
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;
1211 if (end <= mGapStart) {
1232 public float getTextRunAdvances(int start, int end, int contextStart, int contextEnd, int flags,
1238 int len = end - start;
1240 if (end <= mGapStart) {
1272 * @param contextEnd the (non-inclusive) end index of the context