From f4cc496dbe6c518aa2c324c31635584b246af5a6 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Wed, 26 Jan 2011 17:21:05 -0500 Subject: [PATCH] Sort anchored matches before non-anchored matches when doing non-anchored matching. --HG-- branch : key-processing --- common/modules/completion.jsm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/common/modules/completion.jsm b/common/modules/completion.jsm index 7c352d1b..7109bb19 100644 --- a/common/modules/completion.jsm +++ b/common/modules/completion.jsm @@ -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; }