mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-24 12:53:31 +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);
|
filtered = filtered.slice(0, this.maxItems);
|
||||||
|
|
||||||
// Sorting
|
// Sorting
|
||||||
if (this.sortResults && this.compare)
|
if (this.sortResults && this.compare) {
|
||||||
filtered.sort(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;
|
return this.cache.filtered = filtered;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user