Lookahead on @-searches by removing the @

(imported from commit fd8b4dd19db4f291387397a3a795cf9ade5b195a)
This commit is contained in:
Leo Franchi 2013-01-25 12:09:41 -05:00
parent 5e3f043111
commit 4e78d18972
1 changed files with 6 additions and 2 deletions

View File

@ -141,8 +141,12 @@ exports.sort_subjects = function (items) {
}; };
exports.sort_recipients = function (matches) { exports.sort_recipients = function (matches) {
var name_results = prefix_sort(this.query, matches, identity); var query = this.query;
var email_results = prefix_sort(this.query, name_results.rest, email_from_identity); if (query[0] === '@')
query = query.substring(1);
var name_results = prefix_sort(query, matches, identity);
var email_results = prefix_sort(query, name_results.rest, email_from_identity);
var sorted_by_pms = exports.sort_by_pms(email_results.rest); var sorted_by_pms = exports.sort_by_pms(email_results.rest);
return name_results.matches.concat(email_results.matches.concat(sorted_by_pms)); return name_results.matches.concat(email_results.matches.concat(sorted_by_pms));
}; };