From 7632861fc40ffd05b6a1704f629a38250600c294 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 18 Sep 2012 12:54:32 -0400 Subject: STORM-1855: fix performance problem with pasting many lines in script editor --- indra/llui/lltexteditor.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'indra/llui/lltexteditor.cpp') diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 144b6960a1..1e3a99c088 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -1095,7 +1095,8 @@ void LLTextEditor::addChar(llwchar wc) setCursorPos(mCursorPos + addChar( mCursorPos, wc )); } -void LLTextEditor::addLineBreakChar() + +void LLTextEditor::addLineBreakChar(BOOL group_together) { if( !getEnabled() ) { @@ -1113,7 +1114,7 @@ void LLTextEditor::addLineBreakChar() LLStyleConstSP sp(new LLStyle(LLStyle::Params())); LLTextSegmentPtr segment = new LLLineBreakTextSegment(sp, mCursorPos); - S32 pos = execute(new TextCmdAddChar(mCursorPos, FALSE, '\n', segment)); + S32 pos = execute(new TextCmdAddChar(mCursorPos, group_together, '\n', segment)); setCursorPos(mCursorPos + pos); } @@ -1436,21 +1437,28 @@ void LLTextEditor::pasteHelper(bool is_primary) std::basic_string::size_type start = 0; std::basic_string::size_type pos = clean_string.find('\n',start); - while(pos!=-1) + while((pos != -1) && (pos != clean_string.length() -1)) { if(pos!=start) { std::basic_string str = std::basic_string(clean_string,start,pos-start); - setCursorPos(mCursorPos + insert(mCursorPos, str, FALSE, LLTextSegmentPtr())); + setCursorPos(mCursorPos + insert(mCursorPos, str, TRUE, LLTextSegmentPtr())); } - addLineBreakChar(); - + addLineBreakChar(TRUE); // Add a line break and group with the next addition. + start = pos+1; pos = clean_string.find('\n',start); } - std::basic_string str = std::basic_string(clean_string,start,clean_string.length()-start); - setCursorPos(mCursorPos + insert(mCursorPos, str, FALSE, LLTextSegmentPtr())); + if (pos != start) + { + std::basic_string str = std::basic_string(clean_string,start,clean_string.length()-start); + setCursorPos(mCursorPos + insert(mCursorPos, str, FALSE, LLTextSegmentPtr())); + } + else + { + addLineBreakChar(FALSE); // Add a line break and end the grouping. + } deselect(); -- cgit v1.2.3 From 07cc38e9cbd3dafe1373fa59aedbe7fb868cfd68 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 9 Nov 2012 15:12:15 -0500 Subject: STORM-1855: Improve performance of pasting large blocks of text in the script editor --- indra/llui/lltexteditor.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'indra/llui/lltexteditor.cpp') diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 144b6960a1..1e3a99c088 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -1095,7 +1095,8 @@ void LLTextEditor::addChar(llwchar wc) setCursorPos(mCursorPos + addChar( mCursorPos, wc )); } -void LLTextEditor::addLineBreakChar() + +void LLTextEditor::addLineBreakChar(BOOL group_together) { if( !getEnabled() ) { @@ -1113,7 +1114,7 @@ void LLTextEditor::addLineBreakChar() LLStyleConstSP sp(new LLStyle(LLStyle::Params())); LLTextSegmentPtr segment = new LLLineBreakTextSegment(sp, mCursorPos); - S32 pos = execute(new TextCmdAddChar(mCursorPos, FALSE, '\n', segment)); + S32 pos = execute(new TextCmdAddChar(mCursorPos, group_together, '\n', segment)); setCursorPos(mCursorPos + pos); } @@ -1436,21 +1437,28 @@ void LLTextEditor::pasteHelper(bool is_primary) std::basic_string::size_type start = 0; std::basic_string::size_type pos = clean_string.find('\n',start); - while(pos!=-1) + while((pos != -1) && (pos != clean_string.length() -1)) { if(pos!=start) { std::basic_string str = std::basic_string(clean_string,start,pos-start); - setCursorPos(mCursorPos + insert(mCursorPos, str, FALSE, LLTextSegmentPtr())); + setCursorPos(mCursorPos + insert(mCursorPos, str, TRUE, LLTextSegmentPtr())); } - addLineBreakChar(); - + addLineBreakChar(TRUE); // Add a line break and group with the next addition. + start = pos+1; pos = clean_string.find('\n',start); } - std::basic_string str = std::basic_string(clean_string,start,clean_string.length()-start); - setCursorPos(mCursorPos + insert(mCursorPos, str, FALSE, LLTextSegmentPtr())); + if (pos != start) + { + std::basic_string str = std::basic_string(clean_string,start,clean_string.length()-start); + setCursorPos(mCursorPos + insert(mCursorPos, str, FALSE, LLTextSegmentPtr())); + } + else + { + addLineBreakChar(FALSE); // Add a line break and end the grouping. + } deselect(); -- cgit v1.2.3 From d7e041d0c7a6f5e19b12efb434a722d6b4969b24 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 25 Mar 2013 16:11:04 -0400 Subject: correct merge error --- indra/llui/lltexteditor.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'indra/llui/lltexteditor.cpp') diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 4a950638a4..57446e9c56 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -1501,11 +1501,6 @@ void LLTextEditor::pasteTextWithLinebreaks(LLWString & clean_string) { addLineBreakChar(FALSE); // Add a line break and end the grouping. } - } - else - { - addLineBreakChar(FALSE); // Add a line break and end the grouping. - } } // copy selection to primary -- cgit v1.2.3 From 36a51f4927eb1bba511b73613a7f9baeddf467fd Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Tue, 14 May 2013 01:30:23 +0300 Subject: CHUI-958 FIXED Log spam: "drawtext: Ran off Segmentation End" and To field in nearby chat blank when selected --- indra/llui/lltexteditor.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/llui/lltexteditor.cpp') diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 834f213097..09caec7b73 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -1964,8 +1964,7 @@ void LLTextEditor::onFocusReceived() updateAllowingLanguageInput(); } -// virtual, from LLView -void LLTextEditor::onFocusLost() +void LLTextEditor::focusLostHelper() { updateAllowingLanguageInput(); @@ -1982,7 +1981,11 @@ void LLTextEditor::onFocusLost() // Make sure cursor is shown again getWindow()->showCursorFromMouseMove(); +} +void LLTextEditor::onFocusLost() +{ + focusLostHelper(); LLTextBase::onFocusLost(); } -- cgit v1.2.3 From c6d4e449e42bbeea0c8dd7f36cde125f2086584b Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Wed, 22 May 2013 16:35:08 +0300 Subject: CHUI-941 FIXED [CHUIBUG]Inline input is not available in 3.5.0 --- indra/llui/lltexteditor.cpp | 53 ++++++++++++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 18 deletions(-) (limited to 'indra/llui/lltexteditor.cpp') diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 09caec7b73..5e553fcd16 100644 --- 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; -- cgit v1.2.3 From 90a3285e2619cae3fad057168e78030ec1877a32 Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Fri, 31 May 2013 20:05:12 +0300 Subject: CHUI-941 [CHUIBUG]Inline input is not available in 3.5.0 --- indra/llui/lltexteditor.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'indra/llui/lltexteditor.cpp') diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 5e553fcd16..d1c4bcb24b 100755 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -2767,10 +2767,8 @@ void LLTextEditor::updatePreedit(const LLWString &preedit_string, } 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); + //pass empty segments to let "insertStringNoUndo" make new LLNormalTextSegment and insert it, if needed. + insertStringNoUndo(insert_preedit_at, mPreeditWString, &segments); mPreeditStandouts = preedit_standouts; -- cgit v1.2.3