Lines Matching refs:offset

97 	int32	offset;
639 int32 offset = fSelStart;
641 offset = fSelEnd;
643 fTrackingMouse->anchor = offset;
1182 BTextView::SetText(BFile* file, int32 offset, int32 length,
1195 if (!fText->InsertText(file, offset, length, 0))
1198 // update the start offsets of each line below offset
1199 fLines->BumpOffset(length, _LineAt(offset) + 1);
1202 fStyles->BumpOffset(length, fStyles->OffsetToRun(offset - 1) + 1);
1205 SetRunArray(offset, offset + length, runs);
1208 _ApplyStyleRange(offset, offset + length);
1238 BTextView::Insert(int32 offset, const char* text, int32 length,
1241 // pin offset at reasonable values
1242 if (offset < 0)
1243 offset = 0;
1244 else if (offset > fText->Length())
1245 offset = fText->Length();
1248 _DoInsertText(text, strnlen(text, length), offset, runs);
1321 BTextView::GetText(int32 offset, int32 length, char* buffer) const
1324 fText->GetString(offset, length, buffer);
1329 BTextView::ByteAt(int32 offset) const
1331 if (offset < 0 || offset >= fText->Length())
1334 return fText->RealCharAt(offset);
1647 BTextView::GetFontAndColor(int32 offset, BFont* _font,
1650 fStyles->GetStyle(offset, _font, _color);
1683 oneRun.runs[0].offset = 0;
1726 runArray->runs[i].offset = styleRange->runs[i].offset;
1739 BTextView::LineAt(int32 offset) const
1741 // pin offset at reasonable values
1742 if (offset < 0)
1743 offset = 0;
1744 else if (offset > fText->Length())
1745 offset = fText->Length();
1747 int32 lineNum = _LineAt(offset);
1748 if (_IsOnEmptyLastLine(offset))
1766 BTextView::PointAt(int32 offset, float* _height) const
1768 // pin offset at reasonable values
1769 if (offset < 0)
1770 offset = 0;
1771 else if (offset > fText->Length())
1772 offset = fText->Length();
1775 int32 lineNum = _LineAt(offset);
1783 bool onEmptyLastLine = _IsOnEmptyLastLine(offset);
1793 // special case: go down one line if offset is at the newline
1797 fStyles->SyncNullStyle(offset);
1800 int32 length = offset - line->offset;
1801 result.x += _TabExpandedStyledWidth(line->offset, length);
1845 // lower than the bottom of the last line, return the last offset
1867 int32 offset = line->offset;
1868 const int32 limit = (line + 1)->offset;
1871 const int32 nextInitial = _NextInitialByte(offset);
1872 const int32 saveOffset = offset;
1874 if (ByteAt(offset) == B_TAB)
1880 offset = nextInitial;
1885 offset = nextInitial;
1886 } while (offset < limit);
1888 if (offset == (line + 1)->offset) {
1890 // return the offset of the character preceding the newline
1891 if (ByteAt(offset - 1) == B_ENTER)
1892 return --offset;
1894 // special case: return the offset preceding any spaces that
1896 if (offset != textLength && ByteAt(offset - 1) == B_SPACE)
1897 return --offset;
1900 return offset;
1913 return (*fLines)[line]->offset;
1918 BTextView::FindWord(int32 offset, int32* _fromOffset, int32* _toOffset)
1920 if (offset < 0) {
1930 if (offset > fText->Length()) {
1941 *_fromOffset = _PreviousWordBoundary(offset);
1944 *_toOffset = _NextWordBoundary(offset);
1949 BTextView::CanEndLine(int32 offset)
1951 if (offset < 0 || offset > fText->Length())
1955 uint32 classification = _CharClassification(offset);
1958 if (classification == CHAR_CLASS_END_OF_TEXT || ByteAt(offset) == B_ENTER)
1961 uint32 nextClassification = _CharClassification(offset + 1);
1982 || ByteAt(offset + 1) == B_ENTER)) {
2016 int32 length = (line + 1)->offset - line->offset;
2020 if (ByteAt((line + 1)->offset - 1) == B_ENTER)
2023 return _TabExpandedStyledWidth(line->offset, length);
2117 // more than one line in the specified offset range
2151 BTextView::ScrollToOffset(int32 offset)
2155 BPoint point = PointAt(offset, &lineHeight);
2453 int32 offset = fMaxBytes;
2456 const int32 previousInitial = _PreviousInitialByte(offset);
2457 if (_NextInitialByte(previousInitial) != offset)
2458 offset = previousInitial;
2460 Delete(offset, textLength);
2884 copy->runs[i].offset = orig->runs[i].offset;
2928 array->styles[i].offset = B_HOST_TO_BENDIAN_INT32(
2929 runArray->runs[i].offset);
2975 runArray->runs[i].offset = B_BENDIAN_TO_HOST_INT32(
2976 array->styles[i].offset);
3005 BTextView::InsertText(const char* text, int32 length, int32 offset,
3013 if (offset < 0)
3014 offset = 0;
3015 else if (offset > fText->Length())
3016 offset = fText->Length();
3020 fText->InsertText(text, length, offset);
3022 // update the start offsets of each line below offset
3023 fLines->BumpOffset(length, _LineAt(offset) + 1);
3026 fStyles->BumpOffset(length, fStyles->OffsetToRun(offset - 1) + 1);
3028 // offset the caret/selection, if the text was inserted before it
3029 if (offset <= fSelEnd) {
3036 _SetRunArray(offset, offset + length, runs);
3039 _ApplyStyleRange(offset, offset + length);
3415 int32 offset = OffsetAt(point);
3416 if (offset < fCaretOffset || i == height) {
3417 fCaretOffset = offset;
3580 fCaretOffset = line->offset;
3613 // offset of the next line, and go to the previous character
3617 fCaretOffset = _PreviousInitialByte(line->offset);
3752 int32 start, offset;
3753 start = offset = OffsetAt(_LineAt(fSelStart));
3755 while (ByteAt(offset) != '\0' &&
3756 (ByteAt(offset) == B_TAB || ByteAt(offset) == B_SPACE)
3757 && offset < fSelStart)
3758 offset++;
3761 if (start != offset)
3762 _DoInsertText(Text() + start, offset - start, fSelStart, NULL);
3778 \param fromOffset The offset from where to refresh.
3779 \param toOffset The offset where to refresh to.
3780 \param scrollTo Scroll the view to \a scrollTo offset if not \c INT32_MIN.
3869 int32 recalThreshold = (*fLines)[*endLine + 1]->offset;
3875 int32 fromOffset = curLine->offset;
3888 if (lineIndex > fLines->NumLines() || toOffset < nextLine->offset) {
3891 newLine.offset = toOffset;
3897 nextLine->offset = toOffset;
3902 && toOffset >= ((*fLines)[lineIndex] + 1)->offset) {
3907 if (nextLine->offset == saveLine.offset) {
3908 if (nextLine->offset >= recalThreshold) {
3922 } while (curLine->offset < textLength);
4010 int32 offset = fromOffset;
4014 // Just find the offset of the first \n character
4015 offset = limit - fromOffset;
4016 fText->FindChar(B_ENTER, fromOffset, &offset);
4017 offset += fromOffset;
4018 int32 toOffset = (offset < limit) ? offset : limit;
4023 return offset < limit ? offset + 1 : limit;
4035 while (offset < limit && !done) {
4037 for (; (offset + delta) < limit; delta++) {
4038 if (CanEndLine(offset + delta)) {
4039 theChar = fText->RealCharAt(offset + delta);
4053 for (; (offset + delta) < limit; delta++) {
4054 theChar = fText->RealCharAt(offset + delta);
4069 deltaWidth = _TabExpandedStyledWidth(offset,
4089 strWidth += _StyledWidth(offset, deltaBeforeWhitespace, NULL, NULL);
4100 offset += delta;
4104 if (offset - fromOffset < 1) {
4112 for (offset = _NextInitialByte(current); current < limit;
4113 current = offset, offset = _NextInitialByte(offset)) {
4114 strWidth += _StyledWidth(current, offset - current, &ascent,
4117 offset = _PreviousInitialByte(offset);
4126 return std::min(offset, limit);
4131 BTextView::_PreviousLineStart(int32 offset)
4133 if (offset <= 0)
4136 while (offset > 0) {
4137 offset = _PreviousInitialByte(offset);
4138 if (_CharClassification(offset) == CHAR_CLASS_WHITESPACE
4139 && ByteAt(offset) == B_ENTER) {
4140 return offset + 1;
4144 return offset;
4149 BTextView::_NextLineEnd(int32 offset)
4152 if (offset >= textLen)
4155 while (offset < textLen) {
4156 if (_CharClassification(offset) == CHAR_CLASS_WHITESPACE
4157 && ByteAt(offset) == B_ENTER) {
4160 offset = _NextInitialByte(offset);
4163 return offset;
4168 BTextView::_PreviousWordBoundary(int32 offset)
4170 uint32 charType = _CharClassification(offset);
4172 while (offset > 0) {
4173 previous = _PreviousInitialByte(offset);
4176 offset = previous;
4179 return offset;
4184 BTextView::_NextWordBoundary(int32 offset)
4187 uint32 charType = _CharClassification(offset);
4188 while (offset < textLen) {
4189 offset = _NextInitialByte(offset);
4190 if (_CharClassification(offset) != charType)
4194 return offset;
4199 BTextView::_PreviousWordStart(int32 offset)
4201 if (offset <= 1)
4204 --offset;
4206 if (_CharClassification(offset) != CHAR_CLASS_DEFAULT) {
4208 while (offset > 0) {
4209 offset = _PreviousInitialByte(offset);
4210 if (_CharClassification(offset) == CHAR_CLASS_DEFAULT)
4214 while (offset > 0) {
4216 int32 previous = _PreviousInitialByte(offset);
4219 offset = previous;
4222 return offset;
4227 BTextView::_NextWordEnd(int32 offset)
4230 if (_CharClassification(offset) != CHAR_CLASS_DEFAULT) {
4232 while (offset < textLen) {
4233 offset = _NextInitialByte(offset);
4234 if (_CharClassification(offset) == CHAR_CLASS_DEFAULT)
4238 while (offset < textLen) {
4240 offset = _NextInitialByte(offset);
4241 if (_CharClassification(offset) != CHAR_CLASS_DEFAULT)
4245 return offset;
4250 offset with the given length, expanding all tab characters as needed.
4253 BTextView::_TabExpandedStyledWidth(int32 offset, int32 length, float* _ascent,
4265 foundTab = fText->FindChar(B_TAB, offset, &numBytes);
4266 width += _StyledWidth(offset, numBytes, &ascent, &descent);
4278 offset += numBytes;
4294 \param fromOffset The offset where to start.
4306 // determine height of char at given offset, but return empty width
4366 BTextView::_DoInsertText(const char* text, int32 length, int32 offset,
4378 if (offset > textLength)
4379 offset = textLength;
4382 InsertText(text, length, offset, runs);
4385 _Refresh(offset, offset + length);
4406 startLeft = PointAt(line->offset).x;
4416 int32 length = (line + 1)->offset;
4420 length -= line->offset;
4423 if (ByteAt((line + 1)->offset - 1) == B_ENTER)
4442 int32 offset = startOffset != -1 ? startOffset : line->offset;
4448 while ((numBytes = fStyles->Iterate(offset, length, fInline, &font,
4455 foundTab = fText->FindChar(B_TAB, offset, &tabChars);
4459 if (ByteAt(offset + tabChars + numTabs) != B_TAB)
4467 && ((offset <= fInline->Offset()
4468 && fInline->Offset() < offset + tabChars)
4469 || (fInline->Offset() <= offset
4470 && offset < fInline->Offset() + fInline->Length()))) {
4475 GetTextRegion(offset, offset + length, &textRegion);
4502 const char* stringToDraw = fText->GetString(offset, &size);
4535 offset += tabChars;
4621 // Set this to -1 so the next iteration will use the line offset
4665 BTextView::_DrawCaret(int32 offset, bool visible)
4668 BPoint caretPoint = PointAt(offset, &lineHeight);
4709 /*! Place the dragging caret at the given offset.
4711 \param offset The offset (zero based within the object's text) where to
4715 BTextView::_DragCaret(int32 offset)
4718 if (offset == fDragOffset)
4726 if (offset != -1) {
4728 // ignore if offset is within active selection
4729 if (offset >= fSelStart && offset <= fSelEnd) {
4735 _DrawCaret(offset, true);
4738 fDragOffset = offset;
4795 = (*fLines)[_LineAt(currentOffset)]->offset;
4798 : (*fLines)[_LineAt(fTrackingMouse->anchor) + 1]->offset;
4803 : (*fLines)[_LineAt(fTrackingMouse->anchor)]->offset;
4805 = (*fLines)[_LineAt(currentOffset) + 1]->offset;
4921 BTextView::_MessageDropped(BMessage* message, BPoint where, BPoint offset)
5452 int32 fromOffset = theRun->offset + startOffset;
5455 toOffset = (theRun + 1)->offset + startOffset;
5469 /*! Returns the character class of the character at the given offset.
5471 \param offset The offset where the wanted character can be found.
5476 BTextView::_CharClassification(int32 offset) const
5483 switch (fText->RealCharAt(offset)) {
5538 /*! Returns the offset of the next UTF-8 character.
5540 \param offset The offset where to start looking.
5542 \return The offset of the next UTF-8 character.
5545 BTextView::_NextInitialByte(int32 offset) const
5547 if (offset >= fText->Length())
5548 return offset;
5550 for (++offset; (ByteAt(offset) & 0xC0) == 0x80; ++offset)
5553 return offset;
5557 /*! Returns the offset of the previous UTF-8 character.
5559 \param offset The offset where to start looking.
5561 \return The offset of the previous UTF-8 character.
5564 BTextView::_PreviousInitialByte(int32 offset) const
5566 if (offset <= 0)
5571 for (--offset; offset > 0 && count; --offset, --count) {
5572 if ((ByteAt(offset) & 0xC0) != 0x80)
5576 return count ? offset : 0;
5791 int32 offset = fInline->Offset();
5792 const int32 limit = offset + fInline->Length();
5798 while (offset < limit) {
5800 BPoint where = PointAt(offset, &height);
5806 offset = _NextInitialByte(offset);
5836 /*! Returns the line number of the character at the given \a offset.
5841 \param offset The offset of the wanted character.
5843 \return The line number of the character at the given \a offset as an int32.
5846 BTextView::_LineAt(int32 offset) const
5848 return fLines->OffsetToLine(offset);
5868 /*! Returns whether or not the given \a offset is on the empty line at the end
5872 BTextView::_IsOnEmptyLastLine(int32 offset) const
5874 return (offset == fText->Length() && offset > 0
5875 && fText->RealCharAt(offset - 1) == B_ENTER);
5973 runArray->runs[i].offset -= remNext;
5974 while (stringIndex < runArray->runs[i].offset
5981 runArray->runs[i].offset--;