diff --git a/filter/command.go b/filter/command.go index 6ae7b283c..74d877d25 100644 --- a/filter/command.go +++ b/filter/command.go @@ -94,7 +94,7 @@ func (o Options) Run() error { fuzzy: o.Fuzzy, timeout: o.Timeout, hasTimeout: o.Timeout > 0, - sort: o.Sort, + sort: o.Sort && o.FuzzySort, }, options...) tm, err := p.Run() diff --git a/filter/options.go b/filter/options.go index 1490c4964..bf64f074b 100644 --- a/filter/options.go +++ b/filter/options.go @@ -33,7 +33,10 @@ type Options struct { Height int `help:"Input height" default:"0" env:"GUM_FILTER_HEIGHT"` Value string `help:"Initial filter value" default:"" env:"GUM_FILTER_VALUE"` Reverse bool `help:"Display from the bottom of the screen" env:"GUM_FILTER_REVERSE"` - Fuzzy bool `help:"Enable fuzzy matching" default:"true" env:"GUM_FILTER_FUZZY" negatable:""` - Sort bool `help:"Sort the results" default:"true" env:"GUM_FILTER_SORT" negatable:""` + Fuzzy bool `help:"Enable fuzzy matching; otherwise match from start of word" default:"true" env:"GUM_FILTER_FUZZY" negatable:""` + FuzzySort bool `help:"Sort fuzzy results by their scores" default:"true" env:"GUM_FILTER_FUZZY_SORT" negatable:""` Timeout time.Duration `help:"Timeout until filter command aborts" default:"0s" env:"GUM_FILTER_TIMEOUT"` + + // Deprecated: use [FuzzySort]. This will be removed at some point. + Sort bool `help:"Sort fuzzy results by their scores" default:"true" env:"GUM_FILTER_FUZZY_SORT" negatable:"" hidden:""` }