mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-12-23 11:29:01 +00:00
Do not block on --no-sort
This commit is contained in:
parent
8e305edcf2
commit
69d6b58f88
20
fzf
20
fzf
@ -180,7 +180,7 @@ def print_input
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def print_info progress = true, msg = nil
|
def print_info msg = nil
|
||||||
@fan ||= '-\|/-\|/'.split(//)
|
@fan ||= '-\|/-\|/'.split(//)
|
||||||
C.setpos cursor_y - 1, 0
|
C.setpos cursor_y - 1, 0
|
||||||
C.clrtoeol
|
C.clrtoeol
|
||||||
@ -193,8 +193,7 @@ def print_info progress = true, msg = nil
|
|||||||
' '
|
' '
|
||||||
end
|
end
|
||||||
C.attron color(:info, false) do
|
C.attron color(:info, false) do
|
||||||
progress &&= "#{prefix}#{@matches.length}/#{@count}"
|
C.addstr "#{prefix}#{@matches.length}/#{@count}"
|
||||||
C.addstr progress if progress
|
|
||||||
C.addstr msg if msg
|
C.addstr msg if msg
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -337,11 +336,9 @@ searcher = Thread.new {
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
while true
|
while true
|
||||||
wait_for_completion = nil
|
|
||||||
@mtx.synchronize do
|
@mtx.synchronize do
|
||||||
while true
|
while true
|
||||||
events.merge! @events
|
events.merge! @events
|
||||||
wait_for_completion = !@sort && !events[:loaded]
|
|
||||||
|
|
||||||
if @events.empty? # No new events
|
if @events.empty? # No new events
|
||||||
@cv.wait @mtx
|
@cv.wait @mtx
|
||||||
@ -351,7 +348,7 @@ searcher = Thread.new {
|
|||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
||||||
if !wait_for_completion && events[:new]
|
if events[:new]
|
||||||
@lists << [@new, {}]
|
@lists << [@new, {}]
|
||||||
@count += @new.length
|
@count += @new.length
|
||||||
@new = []
|
@new = []
|
||||||
@ -359,15 +356,6 @@ searcher = Thread.new {
|
|||||||
end
|
end
|
||||||
end#mtx
|
end#mtx
|
||||||
|
|
||||||
if wait_for_completion
|
|
||||||
@smtx.synchronize do
|
|
||||||
print_info false, " +#{@new.length}"
|
|
||||||
refresh
|
|
||||||
end
|
|
||||||
sleep((delay = [20, delay + 5].min) * 0.01)
|
|
||||||
next
|
|
||||||
end
|
|
||||||
|
|
||||||
new_search = events[:key] || events[:new]
|
new_search = events[:key] || events[:new]
|
||||||
user_input = events[:key] || events[:vcursor]
|
user_input = events[:key] || events[:vcursor]
|
||||||
progress = 0
|
progress = 0
|
||||||
@ -403,7 +391,7 @@ searcher = Thread.new {
|
|||||||
found.concat(cache[q] ||= q.empty? ? list : begin
|
found.concat(cache[q] ||= q.empty? ? list : begin
|
||||||
if progress < 100 && Time.now - started_at > 0.5
|
if progress < 100 && Time.now - started_at > 0.5
|
||||||
@smtx.synchronize do
|
@smtx.synchronize do
|
||||||
print_info true, " (#{progress}%)"
|
print_info " (#{progress}%)"
|
||||||
refresh
|
refresh
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user