Skip to content
Myr

--sync: Suppress initial render also when focus event is bound

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Junegunn Choi · committed by Junegunn Choi · parent e0ddb97 · Browse files · 3 files+21 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+21 added−6 removed

  • other:+21 added−6 removed

3 files+21 added−6 removed

modified:man/man1/fzf.1+9 added-2 removed
887 unmodified lines
888889.TP890.B "--sync"891Synchronous search for multi-staged filtering. If specified, fzf will launch892the finder only after the input stream is complete.892the finder only after the input stream is complete and the initial filtering893and the associated actions (bound to any of \fBstart\fR, \fBload\fR,894\fBresult\fR, or \fBfocus\fR) are complete.895896.RS895e.g. \fBfzf --multi | fzf --sync\fR897e.g. \fB# Avoid rendering both fzf instances at the same time898 fzf --multi | fzf --sync899900 # fzf will not render intermediate states901 (sleep 1; seq 1000000; sleep 1) |902 fzf --sync --query 5 --listen --bind start:up,load:up,result:up,focus:change-header:Ready\fR903.RE904.TP905.B "--with-shell=STR"906Shell command and flags to start child processes with. On *nix Systems, the
756 unmodified lines
modified:src/terminal.go+7 added-1 removed
913 unmodified lines
914 return &t, nil915}916917func (t *Terminal) deferActivation() bool {918 return t.initDelay == 0 && (t.hasStartActions || t.hasLoadActions || t.hasResultActions)918 return t.initDelay == 0 && (t.hasStartActions || t.hasLoadActions || t.hasResultActions || t.hasFocusActions)919}920921func (t *Terminal) environ() []string {922 env := os.Environ()
313 unmodified lines
1236 // Try to keep the vertical position when the list shrinks1237 t.cy = count - util.Min(count, t.maxItems()) + pos1238 }1239 }1240 needActivation := false1241 if !t.reading {1242 switch t.merger.Length() {1243 case 0:1244 zero := tui.Zero.AsEvent()1245 if _, prs := t.keymap[zero]; prs {1246 t.eventChan <- zero1247 }1248 // --sync, only 'focus' is bound, but no items to focus1249 needActivation = t.suppress && !t.hasResultActions && !t.hasLoadActions && t.hasFocusActions1250 case 1:1251 one := tui.One.AsEvent()1252 if _, prs := t.keymap[one]; prs {1253 t.eventChan <- one
5 unmodified lines
1259 }1260 t.mutex.Unlock()1261 t.reqBox.Set(reqInfo, nil)1262 t.reqBox.Set(reqList, nil)1263 if needActivation {1264 t.reqBox.Set(reqActivate, nil)1265 }1266}12671268func (t *Terminal) output() bool {1269 if t.printQuery {
3565 unmodified lines
modified:CHANGELOG.md+5 added-3 removed
3 unmodified lines
40.53.15------6- Better cache management and improved rendering for `--tail`7- Improved `--sync` behavior8 - When `--sync` is provided, fzf will not render the interface until the initial filtering and associated actions (bound to any of `start`, `load`, or `result`) are complete.8 - When `--sync` is provided, fzf will not render the interface until the initial filtering and the associated actions (bound to any of `start`, `load`, `result`, or `focus`) are complete.9 ```sh10 (sleep 1; seq 1000000; sleep 1) | fzf --sync --query 5 --listen --bind start:up,load:up,result:up10 # fzf will not render intermediate states11 (sleep 1; seq 1000000; sleep 1) |12 fzf --sync --query 5 --listen --bind start:up,load:up,result:up,focus:change-header:Ready13 ```14- GET endpoint is now available from `execute` and `transform` actions (it used to timeout due to lock conflict)15 ```sh14 fzf --listen --bind 'focus:transform-header:curl -s localhost:$FZF_PORT?limit=0 | jq .'16 fzf --listen --sync --bind 'focus:transform-header:curl -s localhost:$FZF_PORT?limit=0 | jq .'17 ```18- Fixed crash when using `--tiebreak=end` with very long items19- Fixed mouse support on Windows20- zsh 5.0 compatibility (thanks to @LangLangBart)
2150 unmodified lines