diff options
Diffstat (limited to 'indra/llui/lltexteditor.cpp')
-rw-r--r-- | indra/llui/lltexteditor.cpp | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index a2063358bd..b70ad4c53c 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -257,6 +257,7 @@ LLTextEditor::LLTextEditor( mIsSelecting( FALSE ), mSelectionStart( 0 ), mSelectionEnd( 0 ), + mScrolledToBottom( FALSE ), mOnScrollEndCallback( NULL ), mOnScrollEndData( NULL ), mCursorColor( LLUI::sColorsGroup->getColor( "TextCursorColor" ) ), @@ -3361,20 +3362,26 @@ void LLTextEditor::reshape(S32 width, S32 height, BOOL called_from_parent) { LLView::reshape( width, height, called_from_parent ); - // if scrolled to bottom, stay at bottom - // unless user is editing text - if (mScrolledToBottom && mTrackBottom && !hasFocus()) - { - endOfDoc(); - } - + // do this first after reshape, because other things depend on + // up-to-date mTextRect updateTextRect(); + + updateLineStartList(); + + // propagate shape information to scrollbar + mScrollbar->setDocSize( getLineCount() ); S32 line_height = llround( mGLFont->getLineHeight() ); S32 page_lines = mTextRect.getHeight() / line_height; mScrollbar->setPageSize( page_lines ); - updateLineStartList(); + // if scrolled to bottom, stay at bottom + // unless user is editing text + // do this after updating page size + if (mScrolledToBottom && mTrackBottom && !hasFocus()) + { + endOfDoc(); + } } void LLTextEditor::autoIndent() @@ -3540,6 +3547,10 @@ void LLTextEditor::appendText(const std::string &new_text, bool allow_undo, bool { mSelectionStart = selection_start; mSelectionEnd = selection_end; + + + + mIsSelecting = was_selecting; setCursorPos(cursor_pos); } @@ -3556,6 +3567,14 @@ void LLTextEditor::appendText(const std::string &new_text, bool allow_undo, bool { blockUndo(); } + + // if scrolled to bottom, stay at bottom + // unless user is editing text + // do this after updating page size + if (mScrolledToBottom && mTrackBottom && !hasFocus()) + { + endOfDoc(); + } } void LLTextEditor::removeTextFromEnd(S32 num_chars) |