From 61ba8d5a11fc1672d1601ae246817f9b3eb29404 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sun, 15 Jun 2014 18:35:47 +0900 Subject: [PATCH] Add a small delay when search is interrupted Search is interrupted when the query string has changed. This frequently happens when the user is actively typing in a query. This (rather arbitrary) delay is introduced not to start the next search immediately, which is likely to be interrupted as well. The result of it is that fzf feels more responsive. --- fzf | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fzf b/fzf index f51ea05..4adda6d 100755 --- a/fzf +++ b/fzf @@ -7,7 +7,7 @@ # / __/ / /_/ __/ # /_/ /___/_/ Fuzzy finder for your shell # -# Version: 0.8.5 (Jun 14, 2014) +# Version: 0.8.5 (Jun 15, 2014) # # Author: Junegunn Choi # URL: https://github.com/junegunn/fzf @@ -629,7 +629,10 @@ class FZF found.concat(q.empty? ? list : matcher.match(list, q, q[0, cx], q[cx..-1])) end - next if skip + if skip + sleep 0.1 + next + end matches = @sort ? found : found.reverse if !empty && @sort && matches.length <= @sort matches = FZF.sort(matches)