diff --git a/src/item.go b/src/item.go index 36f8c0ae777e304e2d3a42d910c31ea3122d058d..584dfd8595762e65e07ef908add4eae6fcbadd43 100644 --- a/src/item.go +++ b/src/item.go @@ -44,6 +44,7 @@ func buildEmptyRank(index int32) [5]int32 { return [5]int32{0, 0, 0, 0, index} } +// Index returns ordinal index of the Item func (item *Item) Index() int32 { return item.rank[4] } diff --git a/src/matcher.go b/src/matcher.go index d320697aa40d54cd0f37f9e74a01349f4f2e00b5..d2a7b3890bdce2ba31a697d03e5ce12a2b36bfa5 100644 --- a/src/matcher.go +++ b/src/matcher.go @@ -200,7 +200,7 @@ func (m *Matcher) scan(request MatchRequest) (*Merger, bool) { } partialResults := make([][]*Item, numSlices) - for _, _ = range slices { + for _ = range slices { partialResult := <-resultChan partialResults[partialResult.index] = partialResult.matches } diff --git a/src/merger.go b/src/merger.go index 26ed17b592e4713bb024516de61b1de845395bd0..0d3fb8015e717d3e8f37209e16e7b252456ddb2e 100644 --- a/src/merger.go +++ b/src/merger.go @@ -2,7 +2,7 @@ package fzf import "fmt" -// Merger with no data +// EmptyMerger is a Merger with no data var EmptyMerger = NewMerger([][]*Item{}, false, false) // Merger holds a set of locally sorted lists of items and provides the view of diff --git a/src/pattern.go b/src/pattern.go index 2df287953cbbdba5945995b1017e39569ebc578c..0bf9af30335fb4ff5a08545c851a8d4eedd11df6 100644 --- a/src/pattern.go +++ b/src/pattern.go @@ -372,8 +372,8 @@ func (p *Pattern) iter(pfun func(bool, bool, util.Chars, []rune) algo.Result, for _, part := range tokens { prefixLength := int32(part.prefixLength) if res := pfun(caseSensitive, forward, part.text, pattern); res.Start >= 0 { - var sidx int32 = res.Start + prefixLength - var eidx int32 = res.End + prefixLength + sidx := res.Start + prefixLength + eidx := res.End + prefixLength return Offset{sidx, eidx, int32(part.trimLength)}, res.Bonus } }