This commit is contained in:
Junegunn Choi 2016-08-14 17:51:34 +09:00
parent 8df7d962e6
commit d4b6338102
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627
4 changed files with 5 additions and 4 deletions

View File

@ -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]
}

View File

@ -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
}

View File

@ -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

View File

@ -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
}
}