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

Fix incorrect ordering of --tiebreak=chunk

This commit is contained in:
Junegunn Choi
2022-08-03 22:18:26 +09:00
parent f7e7259910
commit 38259d0382
5 changed files with 37 additions and 23 deletions

View File

@@ -146,18 +146,20 @@ func Run(opts *Options, version string, revision string) {
// Matcher
forward := true
for _, cri := range opts.Criteria[1:] {
if cri == byEnd {
withPos := false
for idx := len(opts.Criteria) - 1; idx > 0; idx-- {
switch opts.Criteria[idx] {
case byChunk:
withPos = true
case byEnd:
forward = false
break
}
if cri == byBegin {
break
case byBegin:
forward = true
}
}
patternBuilder := func(runes []rune) *Pattern {
return BuildPattern(
opts.Fuzzy, opts.FuzzyAlgo, opts.Extended, opts.Case, opts.Normalize, forward,
opts.Fuzzy, opts.FuzzyAlgo, opts.Extended, opts.Case, opts.Normalize, forward, withPos,
opts.Filter == nil, opts.Nth, opts.Delimiter, runes)
}
matcher := NewMatcher(patternBuilder, sort, opts.Tac, eventBox)