mirror of
https://github.com/RustyRaptor/brackets.git
synced 2026-12-04 00:15:22 -07:00
Add alphabetical secondary sort when bringing prefix matches to the top
This commit is contained in:
1 parent
d947130020
commit
bf7404aa6d
1 file changed
+3
-1
@@ -162,6 +162,8 @@ define(function (require, exports, module) {
|
||||
*/
|
||||
function formatHints(hints, query) {
|
||||
if (query.length > QUERY_PREFIX_LENGTH) {
|
||||
|
||||
// raise the hints that match on prefix to the top of the list.
|
||||
hints.sort(function (hint1, hint2) {
|
||||
var index1 = hint1.value.toLowerCase().indexOf(query.toLowerCase()),
|
||||
index2 = hint2.value.toLowerCase().indexOf(query.toLowerCase());
|
||||
@@ -171,7 +173,7 @@ define(function (require, exports, module) {
|
||||
} else if (index1 !== 0 && index2 === 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
return compareByName(hint1, hint2);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user