summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2013-12-26 01:43:20 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2013-12-26 01:43:20 +0900
commit39eb85596ce22985184c8ecee81069ef64697247 (patch)
tree6add584c0b70f628c289b789c987a89a1a4fd5b8
parentbff7e9edf58a6f47d566053e68c30e2bccfb57d0 (diff)
Fix error on Rubinius
-rwxr-xr-xfzf35
1 files changed, 17 insertions, 18 deletions
diff --git a/fzf b/fzf
index fc318c5d..d7d899c1 100755
--- a/fzf
+++ b/fzf
@@ -556,26 +556,25 @@ class FZF
if new_search && !lists.empty?
q, cx = events.delete(:key) || [q, 0]
empty = matcher.empty?(q)
- matches = fcache[q] ||=
- begin
- found = []
- skip = false
- cnt = 0
- lists.each do |list|
- cnt += list.length
- skip = @mtx.synchronize { @events[:key] }
- break if skip
-
- if !empty && (progress = 100 * cnt / @count.get) < 100 && Time.now - started_at > 0.5
- render { print_info " (#{progress}%)" }
- end
-
- found.concat(q.empty? ? list :
- matcher.match(list, q, q[0, cx], q[cx..-1]))
+ unless matches = fcache[q]
+ found = []
+ skip = false
+ cnt = 0
+ lists.each do |list|
+ cnt += list.length
+ skip = @mtx.synchronize { @events[:key] }
+ break if skip
+
+ if !empty && (progress = 100 * cnt / @count.get) < 100 && Time.now - started_at > 0.5
+ render { print_info " (#{progress}%)" }
end
- next if skip
- @sort ? found : found.reverse
+
+ found.concat(q.empty? ? list :
+ 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)