Cache the result as sorted

This commit is contained in:
Junegunn Choi 2014-02-02 21:41:08 +09:00
parent 301290663d
commit 089691faaf

10
fzf
View File

@ -642,11 +642,11 @@ class FZF
matcher.match(list, q, q[0, cx], q[cx..-1]))
end
next if skip
matches = fcache[q] = @sort ? found : found.reverse
end
if !empty && @sort && matches.length <= @sort
matches = sort_by_rank(matches)
matches = @sort ? found : found.reverse
if !empty && @sort && matches.length <= @sort
matches = sort_by_rank(matches)
end
fcache[q] = matches
end
# Atomic update