diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2022-08-03 22:18:26 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2022-08-03 22:18:26 +0900 |
commit | 38259d0382eba18b66c03d62e35089ec10c24698 (patch) | |
tree | ecd12308c7bfe674d701480b2a1512acb93a5ca7 /src/core.go | |
parent | f7e7259910393ea3eeeb3ac78913e881d4a86691 (diff) |
Fix incorrect ordering of `--tiebreak=chunk`
Diffstat (limited to 'src/core.go')
-rw-r--r-- | src/core.go | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/core.go b/src/core.go index 17198f5b..b4bccfbe 100644 --- a/src/core.go +++ b/src/core.go @@ -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) |