mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-18 00:03:39 -05:00
Cache the result as sorted
This commit is contained in:
6
fzf
6
fzf
@@ -642,12 +642,12 @@ class FZF
|
|||||||
matcher.match(list, q, q[0, cx], q[cx..-1]))
|
matcher.match(list, q, q[0, cx], q[cx..-1]))
|
||||||
end
|
end
|
||||||
next if skip
|
next if skip
|
||||||
matches = fcache[q] = @sort ? found : found.reverse
|
matches = @sort ? found : found.reverse
|
||||||
end
|
|
||||||
|
|
||||||
if !empty && @sort && matches.length <= @sort
|
if !empty && @sort && matches.length <= @sort
|
||||||
matches = sort_by_rank(matches)
|
matches = sort_by_rank(matches)
|
||||||
end
|
end
|
||||||
|
fcache[q] = matches
|
||||||
|
end
|
||||||
|
|
||||||
# Atomic update
|
# Atomic update
|
||||||
@matches.set matches
|
@matches.set matches
|
||||||
|
|||||||
Reference in New Issue
Block a user