Skip to content

Commit 3ac5009

Browse files
authored
fixed filter same results in search (#4991)
* fixed filter same results in search * added comment
1 parent c1c34a1 commit 3ac5009

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

source/MRViewer/MRRibbonSchema.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,12 @@ std::vector<RibbonSchemaHolder::SearchResult> RibbonSchemaHolder::search( const
244244
// clear duplicated results
245245
std::sort( rawResult.begin(), rawResult.end(), [] ( const auto& a, const auto& b )
246246
{
247-
return intptr_t( a.first.item ) < intptr_t( b.first.item );
247+
// tab order sorting has been added to stabilize results for similar queries (i.e. "c" / "cl" / "clo" / "clone", i6438 )
248+
const auto ptrA = intptr_t( a.first.item );
249+
const auto ptrB = intptr_t( b.first.item );
250+
const auto& tabIndexA = a.first.tabIndex;
251+
const auto& tabIndexB = b.first.tabIndex;
252+
return ptrA < ptrB || ( ptrA == ptrB && tabIndexA < tabIndexB );
248253
} );
249254
rawResult.erase(
250255
std::unique( rawResult.begin(), rawResult.end(),

0 commit comments

Comments
 (0)