diff options
author | Kelly Washington <kelly@lindenlab.com> | 2007-05-30 17:39:09 +0000 |
---|---|---|
committer | Kelly Washington <kelly@lindenlab.com> | 2007-05-30 17:39:09 +0000 |
commit | 3e9872a297c3cf3f929e688e0e89a78f6bc050f5 (patch) | |
tree | ab3877f764cc27dbdca0b683f07e6ea3a3ac8a23 /indra/llui/lltexteditor.cpp | |
parent | 7b61f1d0ec30e97fd3b7c5caf4b0e675c6e9a1f5 (diff) |
merge -r61423:62602 svn/branches/maintenance --> release
Diffstat (limited to 'indra/llui/lltexteditor.cpp')
-rw-r--r-- | indra/llui/lltexteditor.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 2b588cacce..9363415dc2 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -289,6 +289,9 @@ LLTextEditor::LLTextEditor( { mSourceID.generate(); + // reset desired x cursor position + mDesiredXPixel = -1; + if (font) { mGLFont = font; @@ -894,6 +897,8 @@ void LLTextEditor::setCursorPos(S32 offset) { mCursorPos = llclamp(offset, 0, (S32)getLength()); updateScrollFromCursor(); + // reset desired x cursor position + mDesiredXPixel = -1; } @@ -3078,6 +3083,9 @@ void LLTextEditor::changePage( S32 delta ) S32 line, offset; getLineAndOffset( mCursorPos, &line, &offset ); + // get desired x position to remember previous position + S32 desired_x_pixel = mDesiredXPixel; + // allow one line overlap S32 page_size = mScrollbar->getPageSize() - 1; if( delta == -1 ) @@ -3092,6 +3100,10 @@ void LLTextEditor::changePage( S32 delta ) setCursorPos(getPos( line + page_size, offset )); mScrollbar->setDocPos( mScrollbar->getDocPos() + page_size ); } + + // put desired position into remember-buffer after setCursorPos() + mDesiredXPixel = desired_x_pixel; + if (mOnScrollEndCallback && mOnScrollEndData && (mScrollbar->getDocPos() == mScrollbar->getDocPosMax())) { mOnScrollEndCallback(mOnScrollEndData); @@ -3107,9 +3119,13 @@ void LLTextEditor::changeLine( S32 delta ) S32 line_start = getLineStart(line); - S32 desired_x_pixel; - - desired_x_pixel = mGLFont->getWidth(mWText.c_str(), line_start, offset, mAllowEmbeddedItems ); + // set desired x position to remembered previous position + S32 desired_x_pixel = mDesiredXPixel; + // if remembered position was reset (thus -1), calculate new one here + if( desired_x_pixel == -1 ) + { + desired_x_pixel = mGLFont->getWidth(mWText.c_str(), line_start, offset, mAllowEmbeddedItems ); + } S32 new_line = 0; if( (delta < 0) && (line > 0 ) ) @@ -3145,6 +3161,9 @@ void LLTextEditor::changeLine( S32 delta ) mAllowEmbeddedItems); setCursorPos (getPos( new_line, new_offset )); + + // put desired position into remember-buffer after setCursorPos() + mDesiredXPixel = desired_x_pixel; unbindEmbeddedChars( mGLFont ); } |