From e96fad30ac06f040099db2148a0f482641d1cbd4 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Tue, 1 Apr 2014 19:00:21 +0300 Subject: MAINT-1180 FIXED Cannot delete object description. --- indra/llui/lllineeditor.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llui') diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 5478e85e13..91d2f8f653 100755 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -253,6 +253,7 @@ void LLLineEditor::onCommit() setControlValue(getValue()); LLUICtrl::onCommit(); + resetDirty(); // Selection on commit needs to be turned off when evaluating maths // expressions, to allow indication of the error position -- cgit v1.2.3 From 8b86130f25a780b7dc623c6f7ff7a9cb6cf22ea1 Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Wed, 7 May 2014 18:42:24 +0300 Subject: MAINT-3967 FIXED Up arrow key does not move the cursor up in chat field. --- indra/llui/lltextbase.cpp | 29 +++++++++++++++++++---- indra/llui/lltextbase.h | 1 + indra/llui/lltexteditor.cpp | 56 ++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 79 insertions(+), 7 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 62edbadb07..183d6481c3 100755 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -225,7 +225,8 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p) mParseHighlights(p.parse_highlights), mBGVisible(p.bg_visible), mScroller(NULL), - mStyleDirty(true) + mStyleDirty(true), + mDrawRightmostCursor(false) { if(p.allow_scroll) { @@ -1510,6 +1511,11 @@ void LLTextBase::reflow() // find and erase line info structs starting at start_index and going to end of document if (!mLineInfoList.empty()) { + if (mDrawRightmostCursor) + { + start_index--; + } + // find first element whose end comes after start_index line_list_t::iterator iter = std::upper_bound(mLineInfoList.begin(), mLineInfoList.end(), start_index, line_end_compare()); line_start_index = iter->mDocIndexStart; @@ -1698,6 +1704,11 @@ S32 LLTextBase::getLineNumFromDocIndex( S32 doc_index, bool include_wordwrap) co } else { + if (mDrawRightmostCursor) + { + doc_index--; + } + line_list_t::const_iterator iter = std::upper_bound(mLineInfoList.begin(), mLineInfoList.end(), doc_index, line_end_compare()); if (include_wordwrap) { @@ -1726,6 +1737,11 @@ S32 LLTextBase::getLineOffsetFromDocIndex( S32 startpos, bool include_wordwrap) } else { + if (mDrawRightmostCursor) + { + startpos--; + } + line_list_t::const_iterator iter = std::upper_bound(mLineInfoList.begin(), mLineInfoList.end(), startpos, line_end_compare()); return startpos - iter->mDocIndexStart; } @@ -2445,7 +2461,7 @@ S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, BOOL round, } else if (hit_past_end_of_line && segmentp->getEnd() >= line_iter->mDocIndexEnd) { - if (getLineNumFromDocIndex(line_iter->mDocIndexEnd - 1) == line_iter->mLineNum) + if (getLineNumFromDocIndex(line_iter->mDocIndexEnd - 1) == line_iter->mLineNum && !mDrawRightmostCursor) { // if segment wraps to the next line we should step one char back // to compensate for the space char between words @@ -2478,8 +2494,13 @@ LLRect LLTextBase::getDocRectFromDocIndex(S32 pos) const // clamp pos to valid values pos = llclamp(pos, 0, mLineInfoList.back().mDocIndexEnd - 1); - // find line that contains cursor - line_list_t::const_iterator line_iter = std::upper_bound(mLineInfoList.begin(), mLineInfoList.end(), pos, line_end_compare()); + S32 corrected_pos = pos; + if (mDrawRightmostCursor && pos > 0) + { + corrected_pos--; + } + + line_list_t::const_iterator line_iter = std::upper_bound(mLineInfoList.begin(), mLineInfoList.end(), corrected_pos, line_end_compare()); doc_rect.mLeft = line_iter->mRect.mLeft; doc_rect.mBottom = line_iter->mRect.mBottom; diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index d1f66b6cfe..51ab81bf29 100755 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -606,6 +606,7 @@ protected: // cursor S32 mCursorPos; // I-beam is just after the mCursorPos-th character. + bool mDrawRightmostCursor; // When cursor is on the rightmost position on the line S32 mDesiredXPixel; // X pixel position where the user wants the cursor to be LLFrameTimer mCursorBlinkTimer; // timer that controls cursor blinking diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index fbd742f615..6bb13516bf 100755 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -1135,8 +1135,14 @@ void LLTextEditor::addChar(llwchar wc) setCursorPos(new_cursor_pos); } } -} + if (mCursorPos > 0) + { + LLRect current_cursor_rect = getDocRectFromDocIndex(mCursorPos); + LLRect prev_cursor_rect = getDocRectFromDocIndex(mCursorPos - 1); + mDrawRightmostCursor = current_cursor_rect.mBottom < prev_cursor_rect.mBottom; + } +} void LLTextEditor::addLineBreakChar(BOOL group_together) { @@ -1282,6 +1288,12 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask) break; case KEY_HOME: + if(mDrawRightmostCursor && mCursorPos > 0) + { + mCursorPos--; + mDrawRightmostCursor = false; + } + startOfLine(); break; @@ -1296,6 +1308,14 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask) case KEY_END: endOfLine(); + if (!mDrawRightmostCursor) + { + mDrawRightmostCursor = true; + if (mCursorPos + 1 < getLength()) + { + setCursorPos(mCursorPos + 1); + } + } break; case KEY_LEFT: @@ -1307,7 +1327,18 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask) { if( 0 < mCursorPos ) { - setCursorPos(mCursorPos - 1); + LLRect current_cursor_rect = getDocRectFromDocIndex(mCursorPos); + LLRect next_cursor_rect = getDocRectFromDocIndex(mCursorPos - 1); + + if (current_cursor_rect.mBottom < next_cursor_rect.mBottom) + { + mDrawRightmostCursor = true; + } + else + { + mDrawRightmostCursor = false; + setCursorPos(mCursorPos - 1); + } } else { @@ -1325,7 +1356,26 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask) { if( mCursorPos < getLength() ) { - setCursorPos(mCursorPos + 1); + LLRect current_cursor_rect = getDocRectFromDocIndex(mCursorPos); + LLRect next_cursor_rect = getDocRectFromDocIndex(mCursorPos + 1); + + if (current_cursor_rect.mBottom > next_cursor_rect.mBottom) + { + if (mDrawRightmostCursor) + { + mDrawRightmostCursor = false; + } + else + { + mDrawRightmostCursor = true; + setCursorPos(mCursorPos + 1); + } + } + else + { + mDrawRightmostCursor = false; + setCursorPos(mCursorPos + 1); + } } else { -- cgit v1.2.3 From 5956e75e174441eeb49d3733b6b096a276ebffd3 Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Wed, 21 May 2014 12:11:34 +0300 Subject: MAINT-4064 FIXED Don't show Folder arrow for folders without visible children. --- indra/llui/llfolderviewitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 83254c2840..7213569487 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -655,7 +655,7 @@ void LLFolderViewItem::drawOpenFolderArrow(const Params& default_params, const L // const S32 TOP_PAD = default_params.item_top_pad; - if (hasVisibleChildren() || getViewModelItem()->hasChildren()) + if (hasVisibleChildren()) { LLUIImage* arrow_image = default_params.folder_arrow_image; gl_draw_scaled_rotated_image( -- cgit v1.2.3 From ef26fdca3d07aee8faa34eb8ae5025b14ab57905 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Tue, 27 May 2014 18:56:15 +0300 Subject: MAINT-4072 FIXED Searching object content by typing letters no longer works for non-capitalised names. --- indra/llui/llfolderview.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index e27e9c0d09..f56af6bb12 100755 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -1369,7 +1369,8 @@ BOOL LLFolderView::search(LLFolderViewItem* first_item, const std::string &searc } } - const std::string current_item_label(search_item->getViewModelItem()->getSearchableName()); + std::string current_item_label(search_item->getViewModelItem()->getSearchableName()); + LLStringUtil::toUpper(current_item_label); S32 search_string_length = llmin(upper_case_string.size(), current_item_label.size()); if (!current_item_label.compare(0, search_string_length, upper_case_string)) { -- cgit v1.2.3 From 24ebc86b4132284113de57b979ded76ce47dce1c Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Thu, 19 Jun 2014 12:07:14 +0300 Subject: MAINT-4157 FIXED Lag meter tool tips are missing units --- indra/llui/llstatgraph.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llstatgraph.cpp b/indra/llui/llstatgraph.cpp index a44bc18733..98962aff9a 100755 --- a/indra/llui/llstatgraph.cpp +++ b/indra/llui/llstatgraph.cpp @@ -44,9 +44,10 @@ LLStatGraph::LLStatGraph(const Params& p) : LLView(p), mMin(p.min), mMax(p.max), - mPerSec(true), + mPerSec(p.per_sec), mPrecision(p.precision), mValue(p.value), + mUnits(p.units), mNewStatFloatp(p.stat.count_stat_float) { setToolTip(p.name()); -- cgit v1.2.3 From f8627d43423d6e2383b13dfa98e26849a51ce39a Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Wed, 18 Jun 2014 20:23:34 +0300 Subject: MAINT-3967 FIXED Up arrow key does not move the cursor up in chat field. --- indra/llui/lltexteditor.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 3a546d041a..49e1991b01 100755 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -1308,13 +1308,22 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask) case KEY_END: endOfLine(); - if (!mDrawRightmostCursor) { - mDrawRightmostCursor = true; - if (mCursorPos + 1 < getLength()) + S32 last_line_index = mLineInfoList.size() - 1; + if (getLineNumFromDocIndex(mCursorPos, true) < last_line_index) { + mDrawRightmostCursor = true; setCursorPos(mCursorPos + 1); } + else if (last_line_index > 0) // only for two and more lines + { + S32 prev_line_width = mLineInfoList[last_line_index - 1].mRect.getWidth(); + S32 last_line_width = mLineInfoList[last_line_index].mRect.getWidth(); + if (prev_line_width <= last_line_width) + { + mDrawRightmostCursor = true; + } + } } break; -- cgit v1.2.3 From 7991fe96ec0223a8e8f4794e21c13cd345c192bc Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Fri, 20 Jun 2014 20:26:51 +0300 Subject: MAINT-3475 FIXED 'windows 64bit (?) crash in LLTextBase::getDocIndexFromLocalCoord' --- indra/llui/lltextbase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index a08b53767e..b6eb150bc3 100755 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -2403,7 +2403,7 @@ S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, BOOL round, // binary search for line that starts before local_y line_list_t::const_iterator line_iter = std::lower_bound(mLineInfoList.begin(), mLineInfoList.end(), doc_y, compare_bottom()); - if (line_iter == mLineInfoList.end()) + if (!mLineInfoList.size() || line_iter == mLineInfoList.end()) { return getLength(); // past the end } -- cgit v1.2.3 From 6b40206279acb608166ae24852b83b1127310800 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Tue, 1 Jul 2014 18:33:23 +0300 Subject: MAINT-4086 FIXED Limit the number items "Replace Current Outfit" or "Wear" applies to --- indra/llui/llui.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llui') diff --git a/indra/llui/llui.h b/indra/llui/llui.h index b162f25887..c727f75c4f 100755 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -86,6 +86,7 @@ enum EAcceptance { ACCEPT_POSTPONED, // we are asynchronously determining acceptance ACCEPT_NO, // Uninformative, general purpose denial. + ACCEPT_NO_CUSTOM, // Denial with custom message. ACCEPT_NO_LOCKED, // Operation would be valid, but permissions are set to disallow it. ACCEPT_YES_COPY_SINGLE, // We'll take a copy of a single item ACCEPT_YES_SINGLE, // Accepted. OK to drag and drop single item here. -- cgit v1.2.3 From ae15e85e9f6e7b804326afa992c34c76388fc8e7 Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Tue, 8 Jul 2014 13:07:46 +0300 Subject: MAINT-3460 FIXED Dictionary doesn't exchange the mispelled word to correct one in a special case --- indra/llui/lltextbase.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index b57e858d9e..2d7062e71d 100755 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1308,14 +1308,14 @@ void LLTextBase::replaceWithSuggestion(U32 index) if ( (it->first <= (U32)mCursorPos) && (it->second >= (U32)mCursorPos) ) { deselect(); - - // Delete the misspelled word - removeStringNoUndo(it->first, it->second - it->first); - // Insert the suggestion in its place LLWString suggestion = utf8str_to_wstring(mSuggestionList[index]); insertStringNoUndo(it->first, utf8str_to_wstring(mSuggestionList[index])); + // Delete the misspelled word + removeStringNoUndo(it->first + (S32)suggestion.length(), it->second - it->first); + + setCursorPos(it->first + (S32)suggestion.length()); break; -- cgit v1.2.3 From 30c73d0f25bd7738c769fdba1ed947e1bfeb6ced Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 14 Jul 2014 12:28:29 +0300 Subject: MAINT-4218 FIXED Adding clothing from inventory closes THAT clothing folder and hides THAT folder --- indra/llui/llfolderviewitem.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 7213569487..9a14d0e419 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -970,8 +970,9 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height ) LL_RECORD_BLOCK_TIME(FTM_ARRANGE); // evaluate mHasVisibleChildren - mHasVisibleChildren = false; - if (getViewModelItem()->descendantsPassedFilter()) + bool default_filter = getRoot()->getFolderViewModel()->getFilter().isDefault(); + mHasVisibleChildren = default_filter && (mItems.size() || mFolders.size()); + if (!default_filter && getViewModelItem()->descendantsPassedFilter()) { // We have to verify that there's at least one child that's not filtered out bool found = false; @@ -1022,7 +1023,12 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height ) for(folders_t::iterator fit = mFolders.begin(); fit != mFolders.end(); ++fit) { LLFolderViewFolder* folderp = (*fit); - folderp->setVisible(folderp->passedFilter()); // passed filter or has descendants that passed filter + + // passedFilter() will show everything that passed filter or has descendants that passed filter + // also it will hide all filter-pending folders (they will be shown later if needed). + // but since refreshed folders are 'pending', they can be rendered invisible by passedFilter() + // even if we are not using filter at the moment, default_filter is used to prevent it + folderp->setVisible(default_filter || folderp->passedFilter()); if (folderp->getVisible()) { @@ -1041,7 +1047,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height ) iit != mItems.end(); ++iit) { LLFolderViewItem* itemp = (*iit); - itemp->setVisible(itemp->passedFilter()); + itemp->setVisible(default_filter || itemp->passedFilter()); if (itemp->getVisible()) { -- cgit v1.2.3 From 0ea34fba7347987d95926ef5ef20019a6e3bcf86 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Tue, 29 Jul 2014 17:55:06 +0300 Subject: MAINT-4289 FIXED [BEAR] Recent Items "Reset Filters" not working correctly reverted and remade MAINT-4218 --- indra/llui/llfolderviewitem.cpp | 38 +++++++++++++++++++++++++------------- indra/llui/llfolderviewitem.h | 1 + 2 files changed, 26 insertions(+), 13 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 9a14d0e419..b9593e745d 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -256,6 +256,24 @@ BOOL LLFolderViewItem::passedFilter(S32 filter_generation) return getViewModelItem()->passedFilter(filter_generation); } +BOOL LLFolderViewItem::isPotentiallyVisible(S32 filter_generation) +{ + // Item should be visible if: + // 1. item passed current filter + // 2. item was updated (gen < 0) but has descendants that passed filter + // 3. item was recently updated and was visible before update + + LLFolderViewModelItem* model = getViewModelItem(); + if (model->getLastFilterGeneration() < 0) + { + return model->descendantsPassedFilter(filter_generation) || getVisible(); + } + else + { + return model->passedFilter(filter_generation); + } +} + void LLFolderViewItem::refresh() { LLFolderViewModelItem& vmi = *getViewModelItem(); @@ -968,11 +986,10 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height ) getRoot()->getFolderViewModel()->sort(this); LL_RECORD_BLOCK_TIME(FTM_ARRANGE); - + // evaluate mHasVisibleChildren - bool default_filter = getRoot()->getFolderViewModel()->getFilter().isDefault(); - mHasVisibleChildren = default_filter && (mItems.size() || mFolders.size()); - if (!default_filter && getViewModelItem()->descendantsPassedFilter()) + mHasVisibleChildren = false; + if (getViewModelItem()->descendantsPassedFilter()) { // We have to verify that there's at least one child that's not filtered out bool found = false; @@ -980,7 +997,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height ) for (items_t::iterator iit = mItems.begin(); iit != mItems.end(); ++iit) { LLFolderViewItem* itemp = (*iit); - found = itemp->passedFilter(); + found = itemp->isPotentiallyVisible(); if (found) break; } @@ -990,7 +1007,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height ) for (folders_t::iterator fit = mFolders.begin(); fit != mFolders.end(); ++fit) { LLFolderViewFolder* folderp = (*fit); - found = folderp->passedFilter(); + found = folderp->isPotentiallyVisible(); if (found) break; } @@ -1023,12 +1040,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height ) for(folders_t::iterator fit = mFolders.begin(); fit != mFolders.end(); ++fit) { LLFolderViewFolder* folderp = (*fit); - - // passedFilter() will show everything that passed filter or has descendants that passed filter - // also it will hide all filter-pending folders (they will be shown later if needed). - // but since refreshed folders are 'pending', they can be rendered invisible by passedFilter() - // even if we are not using filter at the moment, default_filter is used to prevent it - folderp->setVisible(default_filter || folderp->passedFilter()); + folderp->setVisible(folderp->isPotentiallyVisible()); if (folderp->getVisible()) { @@ -1047,7 +1059,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height ) iit != mItems.end(); ++iit) { LLFolderViewItem* itemp = (*iit); - itemp->setVisible(default_filter || itemp->passedFilter()); + itemp->setVisible(itemp->isPotentiallyVisible()); if (itemp->getVisible()) { diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index a9b0201236..0cd20a0f2d 100644 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -254,6 +254,7 @@ public: S32 getIndentation() { return mIndentation; } virtual BOOL passedFilter(S32 filter_generation = -1); + virtual BOOL isPotentiallyVisible(S32 filter_generation = -1); // refresh information from the object being viewed. virtual void refresh(); -- cgit v1.2.3 From 21a0ea1209acc5f531e9ae7a477d0361f107aeee Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 30 Jul 2014 18:39:50 +0300 Subject: MAINT-4218 Adding clothing from inventory closes THAT clothing folder and hides THAT folder fixed issue with 'yet to be started filter' and 'dirty-visible' item. --- indra/llui/llfolderviewitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index b9593e745d..7c88f8fb9b 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -264,7 +264,7 @@ BOOL LLFolderViewItem::isPotentiallyVisible(S32 filter_generation) // 3. item was recently updated and was visible before update LLFolderViewModelItem* model = getViewModelItem(); - if (model->getLastFilterGeneration() < 0) + if (model->getLastFilterGeneration() < 0 && !getFolderViewModel()->getFilter().isModified()) { return model->descendantsPassedFilter(filter_generation) || getVisible(); } -- cgit v1.2.3 From 7982ae6b911b8e0400aa593c476b8a634174a6a5 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 28 Aug 2014 19:36:47 +0300 Subject: MAINT-3967 FIXED Up arrow key does not move the cursor up in chat field. Reverted previous two fixes and modified LLTextBase::changeLine() --- indra/llui/lltextbase.cpp | 34 +++++++----------------- indra/llui/lltextbase.h | 1 - indra/llui/lltexteditor.cpp | 64 ++------------------------------------------- 3 files changed, 11 insertions(+), 88 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 2d7062e71d..9b125a85b9 100755 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -218,8 +218,7 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p) mParseHighlights(p.parse_highlights), mBGVisible(p.bg_visible), mScroller(NULL), - mStyleDirty(true), - mDrawRightmostCursor(false) + mStyleDirty(true) { if(p.allow_scroll) { @@ -1505,11 +1504,6 @@ void LLTextBase::reflow() // find and erase line info structs starting at start_index and going to end of document if (!mLineInfoList.empty()) { - if (mDrawRightmostCursor) - { - start_index--; - } - // find first element whose end comes after start_index line_list_t::iterator iter = std::upper_bound(mLineInfoList.begin(), mLineInfoList.end(), start_index, line_end_compare()); line_start_index = iter->mDocIndexStart; @@ -1698,11 +1692,6 @@ S32 LLTextBase::getLineNumFromDocIndex( S32 doc_index, bool include_wordwrap) co } else { - if (mDrawRightmostCursor) - { - doc_index--; - } - line_list_t::const_iterator iter = std::upper_bound(mLineInfoList.begin(), mLineInfoList.end(), doc_index, line_end_compare()); if (include_wordwrap) { @@ -1731,11 +1720,6 @@ S32 LLTextBase::getLineOffsetFromDocIndex( S32 startpos, bool include_wordwrap) } else { - if (mDrawRightmostCursor) - { - startpos--; - } - line_list_t::const_iterator iter = std::upper_bound(mLineInfoList.begin(), mLineInfoList.end(), startpos, line_end_compare()); return startpos - iter->mDocIndexStart; } @@ -2456,7 +2440,7 @@ S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, BOOL round, } else if (hit_past_end_of_line && segmentp->getEnd() >= line_iter->mDocIndexEnd) { - if (getLineNumFromDocIndex(line_iter->mDocIndexEnd - 1) == line_iter->mLineNum && !mDrawRightmostCursor) + if (getLineNumFromDocIndex(line_iter->mDocIndexEnd - 1) == line_iter->mLineNum) { // if segment wraps to the next line we should step one char back // to compensate for the space char between words @@ -2489,13 +2473,7 @@ LLRect LLTextBase::getDocRectFromDocIndex(S32 pos) const // clamp pos to valid values pos = llclamp(pos, 0, mLineInfoList.back().mDocIndexEnd - 1); - S32 corrected_pos = pos; - if (mDrawRightmostCursor && pos > 0) - { - corrected_pos--; - } - - line_list_t::const_iterator line_iter = std::upper_bound(mLineInfoList.begin(), mLineInfoList.end(), corrected_pos, line_end_compare()); + line_list_t::const_iterator line_iter = std::upper_bound(mLineInfoList.begin(), mLineInfoList.end(), pos, line_end_compare()); doc_rect.mLeft = line_iter->mRect.mLeft; doc_rect.mBottom = line_iter->mRect.mBottom; @@ -2670,6 +2648,12 @@ void LLTextBase::changeLine( S32 delta ) LLRect visible_region = getVisibleDocumentRect(); S32 new_cursor_pos = getDocIndexFromLocalCoord(mDesiredXPixel, mLineInfoList[new_line].mRect.mBottom + mVisibleTextRect.mBottom - visible_region.mBottom, TRUE); + S32 actual_line = getLineNumFromDocIndex(new_cursor_pos); + if (actual_line != new_line) + { + // line edge, correcting position by 1 to move onto proper line + new_cursor_pos += new_line - actual_line; + } setCursorPos(new_cursor_pos, true); } } diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 9c3bc3ed98..738b4d5b8e 100755 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -618,7 +618,6 @@ protected: // cursor S32 mCursorPos; // I-beam is just after the mCursorPos-th character. - bool mDrawRightmostCursor; // When cursor is on the rightmost position on the line S32 mDesiredXPixel; // X pixel position where the user wants the cursor to be LLFrameTimer mCursorBlinkTimer; // timer that controls cursor blinking diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 9219490bf2..cf5fdef539 100755 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -1124,13 +1124,6 @@ void LLTextEditor::addChar(llwchar wc) setCursorPos(new_cursor_pos); } } - - if (mCursorPos > 0) - { - LLRect current_cursor_rect = getDocRectFromDocIndex(mCursorPos); - LLRect prev_cursor_rect = getDocRectFromDocIndex(mCursorPos - 1); - mDrawRightmostCursor = current_cursor_rect.mBottom < prev_cursor_rect.mBottom; - } } void LLTextEditor::addLineBreakChar(BOOL group_together) @@ -1277,12 +1270,6 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask) break; case KEY_HOME: - if(mDrawRightmostCursor && mCursorPos > 0) - { - mCursorPos--; - mDrawRightmostCursor = false; - } - startOfLine(); break; @@ -1297,23 +1284,6 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask) case KEY_END: endOfLine(); - { - S32 last_line_index = mLineInfoList.size() - 1; - if (getLineNumFromDocIndex(mCursorPos, true) < last_line_index) - { - mDrawRightmostCursor = true; - setCursorPos(mCursorPos + 1); - } - else if (last_line_index > 0) // only for two and more lines - { - S32 prev_line_width = mLineInfoList[last_line_index - 1].mRect.getWidth(); - S32 last_line_width = mLineInfoList[last_line_index].mRect.getWidth(); - if (prev_line_width <= last_line_width) - { - mDrawRightmostCursor = true; - } - } - } break; case KEY_LEFT: @@ -1325,18 +1295,7 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask) { if( 0 < mCursorPos ) { - LLRect current_cursor_rect = getDocRectFromDocIndex(mCursorPos); - LLRect next_cursor_rect = getDocRectFromDocIndex(mCursorPos - 1); - - if (current_cursor_rect.mBottom < next_cursor_rect.mBottom) - { - mDrawRightmostCursor = true; - } - else - { - mDrawRightmostCursor = false; - setCursorPos(mCursorPos - 1); - } + setCursorPos(mCursorPos - 1); } else { @@ -1354,26 +1313,7 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask) { if( mCursorPos < getLength() ) { - LLRect current_cursor_rect = getDocRectFromDocIndex(mCursorPos); - LLRect next_cursor_rect = getDocRectFromDocIndex(mCursorPos + 1); - - if (current_cursor_rect.mBottom > next_cursor_rect.mBottom) - { - if (mDrawRightmostCursor) - { - mDrawRightmostCursor = false; - } - else - { - mDrawRightmostCursor = true; - setCursorPos(mCursorPos + 1); - } - } - else - { - mDrawRightmostCursor = false; - setCursorPos(mCursorPos + 1); - } + setCursorPos(mCursorPos + 1); } else { -- cgit v1.2.3