m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-16 15:23:48 -05:00

Add --phony option for disabling search

With --phony, fzf becomes a simply selector interface without its own
search functionality. The query string is only used for building the
command for preview or execute action.

Close #1723
This commit is contained in:
Junegunn Choi
2019-11-09 22:54:48 +09:00
parent dceb5d09cd
commit 11962dabba
2 changed files with 15 additions and 2 deletions

View File

@@ -227,6 +227,12 @@ func Run(opts *Options, revision string) {
for {
delay := true
ticks++
input := func() []rune {
if opts.Phony {
return []rune{}
}
return []rune(terminal.Input())
}
eventBox.Wait(func(events *util.Events) {
if _, fin := (*events)[EvtReadFin]; fin {
delete(*events, EvtReadNew)
@@ -241,7 +247,7 @@ func Run(opts *Options, revision string) {
if opts.Sync {
terminal.UpdateList(PassMerger(&snapshot, opts.Tac))
}
matcher.Reset(snapshot, terminal.Input(), false, !reading, sort)
matcher.Reset(snapshot, input(), false, !reading, sort)
case EvtSearchNew:
switch val := value.(type) {
@@ -249,7 +255,7 @@ func Run(opts *Options, revision string) {
sort = val
}
snapshot, _ := chunkList.Snapshot()
matcher.Reset(snapshot, terminal.Input(), true, !reading, sort)
matcher.Reset(snapshot, input(), true, !reading, sort)
delay = false
case EvtSearchProgress: