Simplify nth comparison when reusing transformed tokens
CodeQL / Analyze (go) (push) Has been cancelled
Test fzf on Linux / build (push) Has been cancelled
Test fzf on macOS / build (push) Has been cancelled

This commit is contained in:
Junegunn Choi committed 2025-01-13 17:37:50 +09:00
1 parent ba0935c71f
commit 56fef7c8df
4 files changed
+14 -19

No files matched your search

+3 -1
View File
@@ -192,11 +192,12 @@ func Run(opts *Options) (int, error) {
}
nth := opts.Nth
nthRevision := 0
patternCache := make(map[string]*Pattern)
patternBuilder := func(runes []rune) *Pattern {
return BuildPattern(cache, patternCache,
opts.Fuzzy, opts.FuzzyAlgo, opts.Extended, opts.Case, opts.Normalize, forward, withPos,
opts.Filter == nil, nth, opts.Delimiter, runes)
opts.Filter == nil, nth, opts.Delimiter, nthRevision, runes)
}
inputRevision := revision{}
snapshotRevision := revision{}
@@ -378,6 +379,7 @@ func Run(opts *Options) (int, error) {
if val.nth != nil {
// Change nth and clear caches
nth = *val.nth
nthRevision++
patternCache = make(map[string]*Pattern)
cache.Clear()
inputRevision.bumpMinor()