Lines Matching defs:offset

684      * Return the text offset of the beginning of the specified line (
743 * Returns true if the character at offset and the preceding character
745 * @param offset the offset
749 public boolean isLevelBoundary(int offset) {
750 int line = getLineForOffset(offset);
759 if (offset == lineStart || offset == lineEnd) {
761 int runIndex = offset == lineStart ? 0 : runs.length - 2;
765 offset -= lineStart;
767 if (offset == runs[i]) {
775 * Returns true if the character at offset is right to left (RTL).
776 * @param offset the offset
779 public boolean isRtlCharAt(int offset) {
780 int line = getLineForOffset(offset);
793 if (offset >= start && offset < limit) {
798 // Should happen only if the offset is "out of bounds"
803 * Returns the range of the run that the character at offset belongs to.
804 * @param offset the offset
808 public long getRunRange(int offset) {
809 int line = getLineForOffset(offset);
819 if (offset >= start && offset < limit) {
823 // Should happen only if the offset is "out of bounds"
827 private boolean primaryIsTrailingPrevious(int offset) {
828 int line = getLineForOffset(offset);
840 if (offset >= start && offset < limit) {
841 if (offset > start) {
856 if (offset == lineStart) {
859 offset -= 1;
866 if (offset >= start && offset < limit) {
877 * Get the primary horizontal position for the specified text offset.
881 public float getPrimaryHorizontal(int offset) {
882 return getPrimaryHorizontal(offset, false /* not clamped */);
886 * Get the primary horizontal position for the specified text offset, but
890 public float getPrimaryHorizontal(int offset, boolean clamped) {
891 boolean trailing = primaryIsTrailingPrevious(offset);
892 return getHorizontal(offset, trailing, clamped);
896 * Get the secondary horizontal position for the specified text offset.
900 public float getSecondaryHorizontal(int offset) {
901 return getSecondaryHorizontal(offset, false /* not clamped */);
905 * Get the secondary horizontal position for the specified text offset, but
909 public float getSecondaryHorizontal(int offset, boolean clamped) {
910 boolean trailing = primaryIsTrailingPrevious(offset);
911 return getHorizontal(offset, !trailing, clamped);
914 private float getHorizontal(int offset, boolean primary) {
915 return primary ? getPrimaryHorizontal(offset) : getSecondaryHorizontal(offset);
918 private float getHorizontal(int offset, boolean trailing, boolean clamped) {
919 int line = getLineForOffset(offset);
921 return getHorizontal(offset, trailing, line, clamped);
924 private float getHorizontal(int offset, boolean trailing, int line, boolean clamped) {
943 float wid = tl.measure(offset - start, trailing, null);
1119 * Get the line number on which the specified text offset appears.
1123 public int getLineForOffset(int offset) {
1129 if (getLineStart(guess) > offset)
1142 * Get the character offset on the specified line whose position is
1150 * Get the character offset on the specified line whose position is
1153 * @param line the line used to find the closest offset
1154 * @param horiz the horizontal position used to find the closest offset
1155 * @param primary whether to use the primary position or secondary position to find the offset
1245 * Return the text offset after the last character on the specified line.
1252 * Return the text offset after the last visible character (so whitespace
1309 public int getOffsetToLeftOf(int offset) {
1310 return getOffsetToLeftRightOf(offset, true);
1313 public int getOffsetToRightOf(int offset) {
1314 return getOffsetToLeftRightOf(offset, false);
1369 private int getOffsetAtStartOf(int offset) {
1372 if (offset == 0)
1376 char c = text.charAt(offset);
1379 char c1 = text.charAt(offset - 1);
1382 offset -= 1;
1386 ReplacementSpan[] spans = ((Spanned) text).getSpans(offset, offset,
1393 if (start < offset && end > offset)
1394 offset = start;
1398 return offset;
1420 * at the specified offset. This will often be a vertical line
1803 * @param h the current horizontal offset
1805 * on the line will be used. If there are no tabs, a default offset
1807 * @return the offset of the next tab stop.
1920 // leading margin. The first int of each pair is the offset from
1936 * Return the offset of the first character to be ellipsized away,