diff options
| author | Merov Linden <merov@lindenlab.com> | 2013-05-22 13:59:53 -0700 | 
|---|---|---|
| committer | Merov Linden <merov@lindenlab.com> | 2013-05-22 13:59:53 -0700 | 
| commit | 51fab4d45ccc83d2dbe0e8b1243964454a13159c (patch) | |
| tree | e403bac2fc6cf9e06a682cf97445ceac4af98b1c | |
| parent | 2113bb8159cda689e8a6001d2d1548cb2c6ab50f (diff) | |
| parent | c6d4e449e42bbeea0c8dd7f36cde125f2086584b (diff) | |
Pull merge from viewer-release
| -rwxr-xr-x | indra/llui/lltexteditor.cpp | 53 | 
1 files changed, 35 insertions, 18 deletions
| diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 09caec7b73..5e553fcd16 100755 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -2131,12 +2131,17 @@ void LLTextEditor::drawPreeditMarker()  					continue;  				} -				S32 preedit_left = mVisibleTextRect.mLeft; +				line_info& line = mLineInfoList[cur_line]; +				LLRect text_rect(line.mRect); +				text_rect.mRight = mDocumentView->getRect().getWidth(); // clamp right edge to document extents +				text_rect.translate(mDocumentView->getRect().mLeft, mDocumentView->getRect().mBottom); // adjust by scroll position + +				S32 preedit_left = text_rect.mLeft;  				if (left > line_start)  				{  					preedit_left += mFont->getWidth(text, line_start, left - line_start);  				} -				S32 preedit_right = mVisibleTextRect.mLeft; +				S32 preedit_right = text_rect.mLeft;  				if (right < line_end)  				{  					preedit_right += mFont->getWidth(text, line_start, right - line_start); @@ -2149,18 +2154,18 @@ void LLTextEditor::drawPreeditMarker()  				if (mPreeditStandouts[i])  				{  					gl_rect_2d(preedit_left + preedit_standout_gap, -							line_y + preedit_standout_position, -							preedit_right - preedit_standout_gap - 1, -							line_y + preedit_standout_position - preedit_standout_thickness, -							(mCursorColor.get() * preedit_standout_brightness + mWriteableBgColor.get() * (1 - preedit_standout_brightness)).setAlpha(1.0f)); +							   text_rect.mBottom + mFont->getDescenderHeight() - 1, +							   preedit_right - preedit_standout_gap - 1, +							   text_rect.mBottom + mFont->getDescenderHeight() - 1 - preedit_standout_thickness, +							   (mCursorColor.get() * preedit_standout_brightness + mWriteableBgColor.get() * (1 - preedit_standout_brightness)).setAlpha(1.0f));  				}  				else  				{  					gl_rect_2d(preedit_left + preedit_marker_gap, -							line_y + preedit_marker_position, -							preedit_right - preedit_marker_gap - 1, -							line_y + preedit_marker_position - preedit_marker_thickness, -							(mCursorColor.get() * preedit_marker_brightness + mWriteableBgColor.get() * (1 - preedit_marker_brightness)).setAlpha(1.0f)); +							   text_rect.mBottom + mFont->getDescenderHeight() - 1, +							   preedit_right - preedit_marker_gap - 1, +							   text_rect.mBottom + mFont->getDescenderHeight() - 1 - preedit_marker_thickness, +							   (mCursorColor.get() * preedit_marker_brightness + mWriteableBgColor.get() * (1 - preedit_marker_brightness)).setAlpha(1.0f));  				}  			}  		} @@ -2243,12 +2248,13 @@ void LLTextEditor::draw()  		LLRect clip_rect(mVisibleTextRect);  		clip_rect.stretch(1);  		LLLocalClipRect clip(clip_rect); -		drawPreeditMarker();  	}  	LLTextBase::draw();  	drawLineNumbers(); +    drawPreeditMarker(); +  	//RN: the decision was made to always show the orange border for keyboard focus but do not put an insertion caret  	// when in readonly mode  	mBorder->setKeyboardFocusHighlight( hasFocus() );// && !mReadOnly); @@ -2698,14 +2704,20 @@ BOOL LLTextEditor::hasPreeditString() const  void LLTextEditor::resetPreedit()  { +    if (hasSelection()) +    { +		if (hasPreeditString()) +        { +            llwarns << "Preedit and selection!" << llendl; +            deselect(); +        } +        else +        { +            deleteSelection(TRUE); +        } +    }  	if (hasPreeditString())  	{ -		if (hasSelection()) -		{ -			llwarns << "Preedit and selection!" << llendl; -			deselect(); -		} -  		setCursorPos(mPreeditPositions.front());  		removeStringNoUndo(mCursorPos, mPreeditPositions.back() - mCursorPos);  		insertStringNoUndo(mCursorPos, mPreeditOverwrittenWString); @@ -2753,7 +2765,12 @@ void LLTextEditor::updatePreedit(const LLWString &preedit_string,  	{  		mPreeditOverwrittenWString.clear();  	} -	insertStringNoUndo(insert_preedit_at, mPreeditWString); +     +	segment_vec_t segments; +    LLStyleConstSP sp(new LLStyle(getStyleParams())); +	segments.push_back(new LLNormalTextSegment(sp, 0, mPreeditWString.length(), *this)); +     +    insertStringNoUndo(insert_preedit_at, mPreeditWString, &segments);   	mPreeditStandouts = preedit_standouts; | 
