summaryrefslogtreecommitdiff
path: root/indra/llui/lltextbase.cpp
diff options
context:
space:
mode:
authorRichard Linden <none@none>2010-07-27 10:30:17 -0700
committerRichard Linden <none@none>2010-07-27 10:30:17 -0700
commitb4dfa76c9de73c6bebf54d6112b699a1e654ba63 (patch)
tree72a2fcddec5d08ce9db9b97984b884bb0943e19f /indra/llui/lltextbase.cpp
parentc8316be258cdf9252c2d1bec0f223bc4245ff205 (diff)
parent50d8cc6d377b90b27c57b390eb6626223a1685a7 (diff)
merge
Diffstat (limited to 'indra/llui/lltextbase.cpp')
-rw-r--r--indra/llui/lltextbase.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 34d58db7f8..a580345b6c 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -1012,22 +1012,25 @@ void LLTextBase::draw()
if (mBGVisible)
{
// clip background rect against extents, if we support scrolling
- LLLocalClipRect clip(doc_rect, mScroller != NULL);
-
+ LLRect bg_rect = mVisibleTextRect;
+ if (mScroller)
+ {
+ bg_rect.intersectWith(doc_rect);
+ }
LLColor4 bg_color = mReadOnly
? mReadOnlyBgColor.get()
: hasFocus()
? mFocusBgColor.get()
: mWriteableBgColor.get();
- gl_rect_2d(mVisibleTextRect, bg_color, TRUE);
+ gl_rect_2d(doc_rect, bg_color, TRUE);
}
// draw document view
LLUICtrl::draw();
{
- // only clip if we support scrolling (mScroller != NULL)
- LLLocalClipRect clip(doc_rect, mScroller != NULL);
+ // only clip if we support scrolling or have word wrap turned off
+ LLLocalClipRect clip(doc_rect, !getWordWrap() || mScroller != NULL);
drawSelectionBackground();
drawText();
drawCursor();
@@ -1495,6 +1498,7 @@ LLTextBase::segment_set_t::iterator LLTextBase::getSegIterContaining(S32 index)
// when there are no segments, we return the end iterator, which must be checked by caller
if (mSegments.size() <= 1) { return mSegments.begin(); }
+ //FIXME: avoid operator new somehow (without running into refcount problems)
segment_set_t::iterator it = mSegments.upper_bound(new LLIndexSegment(index));
return it;
}
@@ -1790,7 +1794,7 @@ void LLTextBase::appendAndHighlightTextImpl(const std::string &new_text, S32 hig
}
else
{
- segments.push_back(new LLNormalTextSegment(sp, segment_start, segment_end, *this ));
+ segments.push_back(new LLNormalTextSegment(sp, segment_start, segment_end, *this ));
}
insertStringNoUndo(getLength(), wide_text, &segments);
@@ -2289,6 +2293,7 @@ void LLTextBase::updateRects()
// allow horizontal scrolling?
// if so, use entire width of text contents
// otherwise, stop at width of mVisibleTextRect
+ //FIXME: consider use of getWordWrap() instead
doc_rect.mRight = mScroller
? llmax(mVisibleTextRect.getWidth(), mTextBoundingRect.mRight)
: mVisibleTextRect.getWidth();