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.
This commit is contained in:
Junegunn Choi 2014-06-15 18:35:47 +09:00
parent 4a3a5ee70d
commit 61ba8d5a11

7
fzf
View File

@ -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)