From 089691faaf9a470847dc4c06824b8f7b219da195 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sun, 2 Feb 2014 21:41:08 +0900 Subject: [PATCH] Cache the result as sorted --- fzf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fzf b/fzf index d29f0b3..2922e4c 100755 --- a/fzf +++ b/fzf @@ -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