diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index ead80658e2c69598d62402d07d3dbc945162f3b6..18f0295d66609ebb5a46d70f36da12688cbaadf0 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -2099,10 +2099,10 @@ void LLTextBase::updateRects()
 	doc_rect.mLeft = 0;
 
 	// allow horizontal scrolling?
-	// if so, use entire width of text contents (sans scrollbars)
+	// if so, use entire width of text contents
 	// otherwise, stop at width of mVisibleTextRect
 	doc_rect.mRight = mScroller 
-		? llmax(mScroller->getRect().mRight - mScroller->getBorderWidth(), mTextBoundingRect.mRight)
+		? llmax(mVisibleTextRect.getWidth(), mTextBoundingRect.mRight)
 		: mVisibleTextRect.getWidth();
 
 	mDocumentView->setShape(doc_rect);