diff options
author | Seth ProductEngine <slitovchuk@productengine.com> | 2011-01-25 01:13:39 +0200 |
---|---|---|
committer | Seth ProductEngine <slitovchuk@productengine.com> | 2011-01-25 01:13:39 +0200 |
commit | 358a091724d8df9a792c4aea73bd708b28400513 (patch) | |
tree | 1b7aae7ed234488a4cd9a2e9799dffdee86c3dbe /indra | |
parent | 39a609a7ae04e2177e5dd522fe880e3aac9a685c (diff) |
STORM-843 FIXED incremental inventory search to use more restrictive or less restrictive filtering.
Stored filter sub-string comparison with new string failed because of non-matching register of compared strings. Transforming the new search term to uppercase before comparing it with previous one allows to determine if filter became more or less restrictive and not to restart the search over.
Used patch provided by Satomi Ahn.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llinventoryfilter.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index ef4774a06d..e22363c2f6 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -393,18 +393,22 @@ void LLInventoryFilter::setFilterUUID(const LLUUID& object_id) void LLInventoryFilter::setFilterSubString(const std::string& string) { - if (mFilterSubString != string) + std::string filter_sub_string_new = string; + mFilterSubStringOrig = string; + LLStringUtil::trimHead(filter_sub_string_new); + LLStringUtil::toUpper(filter_sub_string_new); + + if (mFilterSubString != filter_sub_string_new) { // hitting BACKSPACE, for example - const BOOL less_restrictive = mFilterSubString.size() >= string.size() && !mFilterSubString.substr(0, string.size()).compare(string); + const BOOL less_restrictive = mFilterSubString.size() >= filter_sub_string_new.size() + && !mFilterSubString.substr(0, filter_sub_string_new.size()).compare(filter_sub_string_new); // appending new characters - const BOOL more_restrictive = mFilterSubString.size() < string.size() && !string.substr(0, mFilterSubString.size()).compare(mFilterSubString); + const BOOL more_restrictive = mFilterSubString.size() < filter_sub_string_new.size() + && !filter_sub_string_new.substr(0, mFilterSubString.size()).compare(mFilterSubString); - mFilterSubStringOrig = string; - LLStringUtil::trimHead(mFilterSubStringOrig); - mFilterSubString = mFilterSubStringOrig; - LLStringUtil::toUpper(mFilterSubString); + mFilterSubString = filter_sub_string_new; if (less_restrictive) { setModified(FILTER_LESS_RESTRICTIVE); |