Fix nth highlighting

Fix #4222
This commit is contained in:
Junegunn Choi
2025-02-06 19:56:40 +09:00
parent bbe1721a18
commit 62e0a2824a
5 changed files with 8 additions and 10 deletions

View File

@@ -195,15 +195,14 @@ func Run(opts *Options) (int, error) {
}
nth := opts.Nth
nthRevision := 0
inputRevision := revision{}
snapshotRevision := revision{}
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, nthRevision, runes)
opts.Filter == nil, nth, opts.Delimiter, inputRevision, runes)
}
inputRevision := revision{}
snapshotRevision := revision{}
matcher := NewMatcher(cache, patternBuilder, sort, opts.Tac, eventBox, inputRevision)
// Filtering mode
@@ -382,7 +381,6 @@ 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()