mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-16 02:07:06 +00:00
Reduce the initial delay when --tac is not given
fzf defers the initial rendering of the screen up to 100ms if the input stream is ongoing to prevent unnecessary redraw during the initial phase. However, 100ms delay is quite noticeable and might give the impression that fzf is not snappy enough. This commit reduces the maximum delay down to 20ms when --tac is not specified, in which case the input list quickly fills the entire screen.
This commit is contained in:
parent
95970164ad
commit
8695b5e319
@ -18,7 +18,8 @@ const (
|
||||
defaultCommand = `find . -path '*/\.*' -prune -o -type f -print -o -type l -print 2> /dev/null | sed s/^..//`
|
||||
|
||||
// Terminal
|
||||
initialDelay = 100 * time.Millisecond
|
||||
initialDelay = 20 * time.Millisecond
|
||||
initialDelayTac = 100 * time.Millisecond
|
||||
spinnerDuration = 200 * time.Millisecond
|
||||
|
||||
// Matcher
|
||||
|
@ -22,6 +22,7 @@ import (
|
||||
|
||||
// Terminal represents terminal input/output
|
||||
type Terminal struct {
|
||||
initDelay time.Duration
|
||||
inlineInfo bool
|
||||
prompt string
|
||||
reverse bool
|
||||
@ -198,7 +199,14 @@ func NewTerminal(opts *Options, eventBox *util.EventBox) *Terminal {
|
||||
header = reverseStringArray(opts.Header)
|
||||
}
|
||||
_tabStop = opts.Tabstop
|
||||
var delay time.Duration
|
||||
if opts.Tac {
|
||||
delay = initialDelayTac
|
||||
} else {
|
||||
delay = initialDelay
|
||||
}
|
||||
return &Terminal{
|
||||
initDelay: delay,
|
||||
inlineInfo: opts.InlineInfo,
|
||||
prompt: opts.Prompt,
|
||||
reverse: opts.Reverse,
|
||||
@ -751,7 +759,7 @@ func (t *Terminal) Loop() {
|
||||
t.printHeader()
|
||||
t.mutex.Unlock()
|
||||
go func() {
|
||||
timer := time.NewTimer(initialDelay)
|
||||
timer := time.NewTimer(t.initDelay)
|
||||
<-timer.C
|
||||
t.reqBox.Set(reqRefresh, nil)
|
||||
}()
|
||||
|
Loading…
Reference in New Issue
Block a user