mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-07 02:15:45 +01:00
Sort anchored matches before non-anchored matches when doing non-anchored matching.
--HG-- branch : key-processing
This commit is contained in:
@@ -483,8 +483,13 @@ var CompletionContext = Class("CompletionContext", {
|
||||
filtered = filtered.slice(0, this.maxItems);
|
||||
|
||||
// Sorting
|
||||
if (this.sortResults && this.compare)
|
||||
if (this.sortResults && this.compare) {
|
||||
filtered.sort(this.compare);
|
||||
if (!this.anchored) {
|
||||
let filter = this.filter;
|
||||
filtered.sort(function (a, b) (b.text.indexOf(filter) == 0) - (a.text.indexOf(filter) == 0));
|
||||
}
|
||||
}
|
||||
|
||||
return this.cache.filtered = filtered;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user