From bc404bfffbd2fe44a99588df1b46113fa41b1c4f Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Mon, 27 Feb 2012 13:56:18 -0800 Subject: [PATCH] Sort highest score first, using (-1,0,1) as the return value. --- src/atom/file-finder.coffee | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/atom/file-finder.coffee b/src/atom/file-finder.coffee index 15a98c4b1..7269227ec 100644 --- a/src/atom/file-finder.coffee +++ b/src/atom/file-finder.coffee @@ -60,7 +60,12 @@ class FileFinder extends View urls = @urls else scoredUrls = ({url, score: stringScore(url, query)} for url in @urls) - scoredUrls.sort (a, b) -> a.score > b.score + scoredUrls.sort (a, b) -> + if a.score > b.score then -1 + else if a.score < b.score then 1 + else 0 + window.x = scoredUrls + urls = (urlAndScore.url for urlAndScore in scoredUrls when urlAndScore.score > 0) urls.slice 0, @maxResults